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. Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment 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.