PHP Delete confirmation

PHP Delete confirmation

am 29.04.2011 06:20:16 von Chris Stinemetz

I have been trying to figure out how to add delete confirmation for
the bellow snippet of code. I would prefer not to use javascript. Can
anyone offer any advise on how to right the delete confirmation in
PHP?

Thank you in advance.

P.S. I apologize for the indention. For some reason gmail messes it up.

// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $result )) {

// echo out the contents of each row into a table
echo "";
echo '' . $row['Name'] . '';
echo '' . $row['Date'] . '';
echo '' . $row['StoreInfo'] . '';
echo '' . $row['Address'] . '';
echo '' . $row['Type'] . '';
echo '' . $row['EngTech'] . '';
echo '' . $row['StoreManager'] . '';
echo '' . $row['BBtime'] . '';
echo '' . $row['BBup'] . '';
echo '' . $row['BBdown'] . '';
echo '' . $row['SiteSect'] . '';
echo '' . $row['VoiceCall'] . '';
echo '' . $row['Comments'] . '';
echo 'Edit';
echo 'Delete';
echo "";
}

// close table>
echo "";
?>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP Delete confirmation

am 29.04.2011 09:02:09 von ba_aerts

You could try to reload the same page, but with an added GET-parameter
"delete":

I assume your snippet comes from a script called MAIN.PHP :


if ( $_GET["delete"] == "yes" ) {
$id = $_GET["id"] ;
echo "

ARE YOU SURE ?
" ;
}

while($row = mysql_fetch_array( $result )) {
// rest of your snippet
echo ''
echo '';
echo '';
}

// and so on




If your code below doesn't detect the GET-parameter "delete", it does
what you have now.
If it does detect the parameter, you show a DIV with all formatting and
buttons you want to confirm or abort the delete action.

I've left out some of the parameter checking for clarity.

Why would you want to avoid Javascript ?

Bert

On 29/04/11 06:20, Chris Stinemetz wrote:
> I have been trying to figure out how to add delete confirmation for
> the bellow snippet of code. I would prefer not to use javascript. Can
> anyone offer any advise on how to right the delete confirmation in
> PHP?
>
> Thank you in advance.
>
> P.S. I apologize for the indention. For some reason gmail messes it up.
>
> > // loop through results of database query, displaying them in the table
> while($row = mysql_fetch_array( $result )) {
>
> // echo out the contents of each row into a table
> echo "";
> echo '' . $row['Name'] .'';
> echo '' . $row['Date'] .'';
> echo '' . $row['StoreInfo'] .'';
> echo '' . $row['Address'] .'';
> echo '' . $row['Type'] .'';
> echo '' . $row['EngTech'] .'';
> echo '' . $row['StoreManager'] .'';
> echo '' . $row['BBtime'] .'';
> echo '' . $row['BBup'] .'';
> echo '' . $row['BBdown'] .'';
> echo '' . $row['SiteSect'] .'';
> echo '' . $row['VoiceCall'] .'';
> echo '' . $row['Comments'] .'';
> echo 'Edit';
> echo 'Delete';
> echo "";
> }
>
> // close table>
> echo "";
> ?>


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php