php syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

php syntax

Post 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]
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: php syntax

Post 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>';
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

Post 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>";
Post Reply