wwfc_barmy_army Posted November 17, 2006 Share Posted November 17, 2006 Hello. I have this code:[code=php:0]<?phpinclude 'dbconnect.php';$broken = "Y";$id = $_GET['id'];$update = mysql_query("UPDATE t_50 SET broken = '$broken' WHERE id = '$id'") or die(mysql_error());?>Thanks, we will have a look at it :) [/code]This code just basically adds something to the 'reported' list. But it happens as soon as the page is loaded. I want something on it so that it can say "Are you sure you want to report?", Then there is a yes and no button. The yes button submits it and the no button cancels it and says "Nothing has been reported". I''m not sure how to do this though. Can anyone offer any advice/code?Thanks. Link to comment https://forums.phpfreaks.com/topic/27581-confirm-before-submit/ Share on other sites More sharing options...
komquat Posted November 17, 2006 Share Posted November 17, 2006 I am assuming that this comes from another form.Try something like this[code=php:0]<?if ($run_update == "yes") {$broken = "Y";$id = $_GET['id'];$update = mysql_query("UPDATE t_50 SET broken = '$broken' WHERE id = '$id'") or die(mysql_error());}$display_= "<table border-'1' align='center'> <tr><form method='get' action='$_SERVER[PHP_SELF]'> <input type='hidden' name='run_update' value='yes'> <td>Are you sure you want to run update?</td> <td><input type='submit' name='submit' value='Yes'></td> </form></tr> </table>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/27581-confirm-before-submit/#findComment-126136 Share on other sites More sharing options...
wwfc_barmy_army Posted November 17, 2006 Author Share Posted November 17, 2006 Ok. Got it eventually. I used your code but had to make quite a few changes for it to pass the id value properly etc. Thanks. Link to comment https://forums.phpfreaks.com/topic/27581-confirm-before-submit/#findComment-126194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.