RE: PHP delete confirmation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This can be done in the delete.php file OR use javascript onClick to confirm
the intent.


Delete.php
<?php
If($_GET['confirm'] == "Yes")
{
	//Delete actions
}else If($_GET['confirm'] == "No")
{
	//No Delete actions.
}else{
//display a delete confirmation and remember to carry required information
like the value you passed for delete.
}
?>


Personally I would use the javascript page navigation is senseless if they
miss click.
 
Javascript: Small and simple javascript.

onclick="return confirm('Are you sure you want to delete?')"



Richard L. Buskirk


-----Original Message-----
From: Chris Stinemetz [mailto:chrisstinemetz@xxxxxxxxx] 
Sent: Friday, April 29, 2011 12:33 AM
To: php-general@xxxxxxxxxxxxx
Subject:  PHP delete confirmation

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.

<?php
       // 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 "<tr>";
                   echo '<td>' . $row['Name'] . '</td>';
                   echo '<td>' . $row['Date'] . '</td>';
                   echo '<td>' . $row['StoreInfo'] . '</td>';
                   echo '<td>' . $row['Address'] . '</td>';
                   echo '<td>' . $row['Type'] . '</td>';
                   echo '<td>' . $row['EngTech'] . '</td>';
                   echo '<td>' . $row['StoreManager'] . '</td>';
                   echo '<td>' . $row['BBtime'] . '</td>';
                   echo '<td>' . $row['BBup'] . '</td>';
                   echo '<td>' . $row['BBdown'] . '</td>';
                   echo '<td>' . $row['SiteSect'] . '</td>';
                   echo '<td>' . $row['VoiceCall'] . '</td>';
                   echo '<td>' . $row['Comments'] . '</td>';
                   echo '<td><a href="edit.php?id=' . $row['id']
.'">Edit</a></td>';
                   echo '<td><a href="delete.php?id=' . $row['id']
.'">Delete</a></td>';
                   echo "</tr>";
       }

       // close table>
       echo "</table>";
?>

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


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux