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 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 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 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 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) 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 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 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
Archived
This topic is now archived and is closed to further replies.