Trouble outputting delete function in table

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
mrgooding
Forum Newbie
Posts: 23
Joined: Thu May 22, 2008 11:45 am

Trouble outputting delete function in table

Post by mrgooding »

Hi All

I'm having trouble putting a Delete Button into a table, to allow a given row to be deleted:

Echo"<td><a href=' . $_SERVER['PHP_SELF'] . '?deletecontact=' . $cid . '>' . 'Delete </a></td>";

is the code i'm using, but this causes an error - It worked ok before I put it into a table cell, but then previously it had some " marks within the code, which i've now had to remove because of using the echo function.

Any pointers as to why this won't work would be greatly appreciated (i'd rather know the reason why this doesn't work than just have someone solve it for me).
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: Trouble outputting delete function in table

Post by WebbieDave »

You're not closing and reopening your quotes correctly.

Here's how I'd write it:

Code: Select all

echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?deletecontact=' . $cid . '">Delete</a></td>';
mrgooding
Forum Newbie
Posts: 23
Joined: Thu May 22, 2008 11:45 am

Re: Trouble outputting delete function in table

Post by mrgooding »

Thanks, WebbieDave - that works now :)
Post Reply