DrTrans Posted August 29, 2009 Share Posted August 29, 2009 if($screenstatus == "Declined") { print"<br> Screening: <font color=\"red\">$screenstatus</font></b>   <input type=\"submit\" name=\"approve\" value=\"Approve\"><hr>\n"; On Button click i want it to alert " Are you sure you want to approve," if you click yes it connects to the database and changes the field from 0 to 1. can this be done easily? Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/ Share on other sites More sharing options...
asmith Posted August 29, 2009 Share Posted August 29, 2009 You haven't showed us the part when it wants to changes the value of them field in the database. But the confirmation will be like this: if($screenstatus == "Declined") { print"<br> Screening: <font color=\"red\">$screenstatus</font></b>   <input type=\"submit\" name=\"approve\" value=\"Approve\" onclick=\"return confirm('Are you sure you want to approve?');\"><hr>\n"; Notice that it is a javascript code. (You can't fully rely on it, Cause it can be disabled) Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908775 Share on other sites More sharing options...
trq Posted August 29, 2009 Share Posted August 29, 2009 onClick is a client side (Javascript) event, this is the PHP Coding Help board. Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908777 Share on other sites More sharing options...
DrTrans Posted August 29, 2009 Author Share Posted August 29, 2009 I understand that. but once confirming the onClick event. how would i make PHP connect to database and change the value... Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908778 Share on other sites More sharing options...
trq Posted August 29, 2009 Share Posted August 29, 2009 That would all be taken care of within the script your forms action points to. Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908782 Share on other sites More sharing options...
DrTrans Posted August 29, 2009 Author Share Posted August 29, 2009 if i put in a <form action="approveapp.php"> before the <input type> code. It drops the button to the next line and puts in extra page breaks.. I want it on all a single line. Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908786 Share on other sites More sharing options...
asmith Posted August 29, 2009 Share Posted August 29, 2009 Then you are using Internet Explorer XD try this: <form action="approveapp.php" style="margin:0px;"> Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908788 Share on other sites More sharing options...
trq Posted August 29, 2009 Share Posted August 29, 2009 Again, this is not a php issue. Link to comment https://forums.phpfreaks.com/topic/172358-solved-onclick-handler/#findComment-908789 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.