robert_gsfame Posted November 7, 2009 Share Posted November 7, 2009 Can anyone help me? i would like to give some alert once submit button was clicked and (!isset($_POST['checkbox'])) thx Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/ Share on other sites More sharing options...
Scotty2024 Posted November 7, 2009 Share Posted November 7, 2009 if(isset($_POST['submit'])) { if(isset($_POST['checkbox'])) { //proceed } else { $checkBoxFlag = true; } } //at your form or wherever if($checkBoxFlag) { echo 'You must check the checkbox'; } //form code here Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-952978 Share on other sites More sharing options...
robert_gsfame Posted November 7, 2009 Author Share Posted November 7, 2009 this is not what i'm looking for... i want create an alert in javascript Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-952980 Share on other sites More sharing options...
Scotty2024 Posted November 7, 2009 Share Posted November 7, 2009 if(isset($_POST['submit'])) { if(isset($_POST['checkbox'])) { //proceed } else { $checkBoxFlag = true; } } //at your form or wherever if($checkBoxFlag) { ?> <script type="text/javascript"> alert("You must check the checkbox"); </script> <?PHP } //form code here Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-952981 Share on other sites More sharing options...
robert_gsfame Posted November 7, 2009 Author Share Posted November 7, 2009 not even that... when i use that code tjen the alert will come together with a blank page i want have it in javascript function (onclick) Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-952982 Share on other sites More sharing options...
rajivgonsalves Posted November 7, 2009 Share Posted November 7, 2009 onclick of what ? if you post some code we could help Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-952983 Share on other sites More sharing options...
mikesta707 Posted November 7, 2009 Share Posted November 7, 2009 create a javascript function that will check if the check box is checked and call that function in the onSubmit attribute of your submit button Quote Link to comment https://forums.phpfreaks.com/topic/180635-alert-once-submit-button-clicked-and-checkbox-is-empty/#findComment-953025 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.