Jump to content

to delete a message on the posted board....


eduardo_consolacion

Recommended Posts

i've created a posted board like this in a certain page called "board.php":

 

ID TO                            FROM                SUBJECT                    DESCRIPTION                          CHOICES    TO    MAKE

1 [email protected]  [email protected]    product sold is broken  the chair that i got is broken....  ADD          EDIT    DELETE

2 [email protected]  [email protected]    about the item      computer screen is damage....    ADD          EDIT    DELETE

3

4

 

The ADD, EDIT, DELETE is a clickable using an <a href ="add.php ">, <a href ="edit.php ">.

Now my question are as follow:

1)  how would you delete the entire row if you click the DELETE in row number 1?

2) would you use <a href ="delete.php "> to delete it or other code to use it?

3)  I want also to redirect the page to itself when the process is done, how would you do that? 

4) I want to make sure that both in the PHP DATABASE will be DELETED as the board.php will be change into something like this:

 

ID TO                            FROM                SUBJECT                    DESCRIPTION                          CHOICES    TO    MAKE

2 [email protected]  [email protected]    about the item      computer screen is damage....    ADD          EDIT    DELETE

3

4

 

I do hope that you can help?

Link to comment
https://forums.phpfreaks.com/topic/67991-to-delete-a-message-on-the-posted-board/
Share on other sites

On your display page:

<a href=delete.php?id=$id>Delete </a>

 

delete.php would contain:

$sql = "DELETE FROM cghl WHERE id='$id'";
if (!mysql_query($sql,$connection))
{
die('Error: ' . mysql_error());
}
echo "<p>1 record deleted</p>";
[code]

[/code]

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.