desjardins2010 Posted February 6, 2014 Share Posted February 6, 2014 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 More sharing options...
Barand Posted February 6, 2014 Share Posted February 6, 2014 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>"; Link to comment https://forums.phpfreaks.com/topic/285995-how-to-write-this-line-of-code/#findComment-1467968 Share on other sites More sharing options...
gristoi Posted February 7, 2014 Share Posted February 7, 2014 i personally like to use this approach to make it stand out a little more : echo "<tr><td>$prog_name</td><td><a href={ htmlspecialchars($_SERVER["PHP_SELF"]) }?id={ $title }'>EDIT</a></td></tr>"; Link to comment https://forums.phpfreaks.com/topic/285995-how-to-write-this-line-of-code/#findComment-1468059 Share on other sites More sharing options...
Barand Posted February 7, 2014 Share Posted February 7, 2014 Why would you personally like something that doesn't work? Link to comment https://forums.phpfreaks.com/topic/285995-how-to-write-this-line-of-code/#findComment-1468061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.