Page 1 of 1
php syntax
Posted: Sat Jul 02, 2005 6:41 pm
by quadoc
I've the following line that gave me an error. Could someone see what the problem with it and post the correct syntax. I'm pretty new to PHP. Thanks...
Code: Select all
echo "<td><a href=\"?x=admin&a=delete&tix=".$tixid."\"><img src="images/delete.gif" width="15" height="15" border="0"><br></a></td>
d11wtq | Please use Code: Select all
tags and DO NOT disable BBCode [/color]
Re: php syntax
Posted: Sat Jul 02, 2005 6:46 pm
by Chris Corbyn
You'd stopped escaping your quotes from <img src... onwards. You were also missing the closing quote and semi-colon but I guess that was a cut/paste issue.
Code: Select all
echo "<td><a href=\"?x=admin&a=delete&tix=".$tixid."\"><img src=\"images/delete.gif\" width=\"15\" height=\"15\" border=\"0\"><br></a></td>";
EDIT | ...........
You know, it makes more sense to use single quotes here (less escaping needed). Some say they parse faster too.
Code: Select all
echo '<td><a href="?x=admin&a=delete&tix='.$tixid.'"><img src="images/delete.gif" width="15" height="15" border="0"><br></a></td>';
Posted: Sat Jul 02, 2005 7:13 pm
by quadoc
Thanks for the corrections. I don't get the error any more but some how only the icon display. I think I'm going to post the whole thing here, maybe you see something's wrong with it.
I've the following code and I want to replace the "X" with the "delete.gif" icon.
echo "<td>".$timelapsedstr."</td><td>".date("m/d/Y, g:i a", $tixdate)."</td>
<td>$tixemail</td>
<td>$tixpir</td>
<td>".$assigned_to."</td>
<td>".$ticket_hash."</td>
<td>".$s_status."</td>
<td><a href=\"?x=admin&a=delete&tix=".$tixid."\"> <center>X[/b]</center> </a></td>
</tr>";