dare87 Posted August 10, 2007 Share Posted August 10, 2007 I have a page that I press the "Delete" button that then triggers this code <?php // Include the PHP script that contains the session information. include('../includes/session_admin.php'); // Get the user id from the URL. $bid = $_GET['bid']; // Connect to the database. require_once ('../../../datemysql_connect.php'); // Set up the query. $query = "DELETE FROM listing WHERE b_id=$bid"; // Run the query. $results = @mysql_query ($query); // Reload the page. $url = '../b_review.php'; header("Location: $url"); ?> Is there a way to add a Warning.. so that if I click it it will popup(if pos) and say... ARE YOU SURE... or something like that.. or would there be a better way to do it? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/ Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 use a javascript something like onlick event you dont show the page for that so i dont know where to start Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320751 Share on other sites More sharing options...
dare87 Posted August 10, 2007 Author Share Posted August 10, 2007 That would be a great idea... but i don't know java at all Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320755 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 it not java its javascript <input name="" type="button" onclick="javascript: var x= confirm('sure you want to delete'); if (x==false){return false;}"/> something like that Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320764 Share on other sites More sharing options...
dare87 Posted August 10, 2007 Author Share Posted August 10, 2007 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320767 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 is this solved Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320779 Share on other sites More sharing options...
dare87 Posted August 10, 2007 Author Share Posted August 10, 2007 no... I am having a problem getting it to work with my code.... When I put the code in it will no longer display the page <?php // Fetch and print all the records. $bg = '#dee4ed'; // Set the background color. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // Alternate the background color. $bg = ($bg == '#dee4ed' ? '#ffffff' : '#dee4ed'); echo ' <tr bgcolor="' . $bg . '"> <td align="left"><a href="b_edit.php?bname=' . $row['bname'] . '&city=' . $row['city'] . '&bid=' . $row['bid'] . '">Edit</a></td> <td align="left"><a href="auxiliary/b_delete.php?bid=' . $row['bid'] . '" onclick="javascript: var x= confirm('Are you sure!'); if (x==false){return false;}"/>Delete</a></td> <td align="left">' . $row['bname'] . '</td> <td align="left">' . $row['city'] . '</td> <td align="left">' . $row['date'] . '</td> </tr>'; } // Close the table. echo '</table>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320781 Share on other sites More sharing options...
teng84 Posted August 10, 2007 Share Posted August 10, 2007 replace the single quote confirm("Are you sure!"); Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320784 Share on other sites More sharing options...
dare87 Posted August 10, 2007 Author Share Posted August 10, 2007 now the page will load.. but when you hit delete it does not confirm... it just deleted it Quote Link to comment https://forums.phpfreaks.com/topic/64323-solved-warning/#findComment-320787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.