Log in

View Full Version : I need to echo $qs within an echo, but what I have isn't working....



qwikad.com
03-17-2013, 03:51 PM
Hi guys!

I need to show a $qs within an echo, but I have no clue how. Right now I have this and it's not showing:

echo '<a href="/?<?php echo $qs; ?>do=reportabuse&confirm=1">confirm</a>';

How do I make <?php echo $qs; ?> to actually show in this instance?


Thanks!

Beverleyh
03-17-2013, 04:08 PM
You're trying to echo inside of an echo - either break out of php by closing the tag first, and then echo within the HTML;
// end php
?>
<a href="/?<?php echo $qs; ?>do=reportabuse&confirm=1">confirm</a>
<?php // start php again
Or remove the second echo and break in and out of the string with '.$variable.';
echo '<a href="/?'.$qs.'do=reportabuse&confirm=1">confirm</a>';
Also, don't forget the semi-colon on the end of your echo.

qwikad.com
03-17-2013, 04:27 PM
It's working. You rock!