deanogallagher Posted July 13, 2006 Share Posted July 13, 2006 Hi,I'm validating a form by posting the form to itself, which means if the form is valid it just comes back from the server the same, is there a way i can post if valid. Basically I want to be able to do the following after submitting the form to itself and processing the validation:if (valid) show next.phpelse print error messagesThanks in advanceDean Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/ Share on other sites More sharing options...
GingerRobot Posted July 13, 2006 Share Posted July 13, 2006 Show us what you have so far Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/#findComment-57231 Share on other sites More sharing options...
hackerkts Posted July 13, 2006 Share Posted July 13, 2006 Is that possible ?From my knowledge of php, I don't think it's possible. It's just like how do you tell the script to react when the page is blank ? Hope you understand what I mean. Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/#findComment-57256 Share on other sites More sharing options...
GingerRobot Posted July 13, 2006 Share Posted July 13, 2006 From what i can workout, the title is misleading - thats why im asking for his form and php code so far. Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/#findComment-57257 Share on other sites More sharing options...
zq29 Posted July 13, 2006 Share Posted July 13, 2006 I'm not sure if this will work, but could you do it with a mix of JavaScript and PHP?[code]if(valid) { echo "<script type='text/javascript'>document.myformname.submit();</script>";} else { //print error messages}[/code]Alternatively, you could store the information you want to pass within a session variable, or even pass it through the URL... Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/#findComment-57272 Share on other sites More sharing options...
hackerkts Posted July 13, 2006 Share Posted July 13, 2006 Hmm.. I think now I got what he trying to ask, hope I got it right now.You create your form scripts, then name the submit "submit".And your form post method is [b]<?php echo $_SERVER['PHP_SELF']; ?>[/b]So you just need to do this,[code]if (isset($_POST['submit'])) { // show next page} else { // echo error}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14467-posting-without-clicking-submit/#findComment-57359 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.