Jump to content

how to write this line of code


desjardins2010

Recommended Posts

echo "<tr><td>".$prog_name."</td><td><a href='".<?php echo htmlspecialchars($_SERVER["PHP_SELF"])?>."?id=".$title."'>EDIT</a></td></tr>";

what am I doing wrong - and could you please just explain my mistake so I can learn from it.. I know it's having to do with the "" and '' but I confuse on where to use them

Link to comment
https://forums.phpfreaks.com/topic/285995-how-to-write-this-line-of-code/
Share on other sites

You are using "echo" at the beginning of the line so you must already be inside PHP tags. In that case you do no need the extra "<?php echo ... ?>"around the htmlentities.

 

Also when using double-quotes you do not need to concatenate php variable names.

echo "<tr><td>$prog_name</td><td><a href='". htmlspecialchars($_SERVER["PHP_SELF"]) . "?id=$title'>EDIT</a></td></tr>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.