ali_2kool2002 Posted February 28, 2007 Share Posted February 28, 2007 hi can anyone code something that will check once a button is clicked if there is a value selected in a combo box on the same page instead of moving to another page which handles the validation ? Link to comment https://forums.phpfreaks.com/topic/40522-validating-on-same-page/ Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 plz clarify it a bit more.. Link to comment https://forums.phpfreaks.com/topic/40522-validating-on-same-page/#findComment-196074 Share on other sites More sharing options...
nloding Posted February 28, 2007 Share Posted February 28, 2007 Um, you code it and if it doesn't work we'll help you fix it. You want one of two things: either put your PHP validation above all the other HTML on the page, and make the form action post/get to itself (ie, <form action="" method="post">). Or, you can use Javascript, have it pull the values of the objects from the DOM, validate it, then send you on to the next page if it passes. If you don't want to do a page refresh, you need PHP + Ajax, check out the tutorials on www.ajaxfreaks.com for more info. Link to comment https://forums.phpfreaks.com/topic/40522-validating-on-same-page/#findComment-196081 Share on other sites More sharing options...
flappy_warbucks Posted February 28, 2007 Share Posted February 28, 2007 hi can anyone code something that will check once a button is clicked if there is a value selected in a combo box on the same page instead of moving to another page which handles the validation ? <?php $sub = $_REQUEST['sub']; $combo = $_RESUEST['combo']; if (!isset($sub)) { enter(); } else if ($sub) { validation($combo); } function enter() { // action depening on what you want done if there is no submission in the $sub varable i.e. HTML form asking for input from a combo box // the $sub varable will be passed by <input type="hidden" name="sub" value="1"> in the HTML element of the form. } function validation($combo) { // action depending on what you want done once you have that information and the form has been submitted } ?> Link to comment https://forums.phpfreaks.com/topic/40522-validating-on-same-page/#findComment-196082 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.