monkeybidz Posted June 20, 2007 Share Posted June 20, 2007 This form posts an error message to itself along with the original form if error is present on a page named quote.php. If errors are not present, the form will continue to the next page. The problem is, when i do get an error and make the correction, the form error is still there, how can i unset the error upon submiting? $recto is the form action value or: <form name="form1" method="post" action="<? echo "$recto";?>"> <input name="zip1" type="text" id="zip1"> <input type="submit" name="Submit" value="Continue"> </form> Here is the form checking code i made: What am i doing very wrong? <? $arrErrors = array("01"=>"Origin Zip Code Missing!"); if (!empty($_POST['Submit'])) { if ($_POST['zip1']==''|| $_POST['zip1'] == false) $arrErrors['01'] = 'Enter a valid USA Zip Code for your origin.'; if (count($arrErrors) == 0) { $recto = "quote1.php"; }else{ $strError = '<div class="formerror"><p><img src="/images/stop_sign.jpg" width="16" height="16" hspace="5" alt="">Please check the following and try again:</p><ul>'; $recto = "quote.php"; foreach ($arrErrors as $error) { $strError .= "<li>$error</li>"; } $strError .= '</ul></div>'; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/56295-form-submit-to-itself-on-error/ Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 is this an input validation then why not use the header file and are u trying to have a php self with that codes clarification pls?? ASTIG!! Quote Link to comment https://forums.phpfreaks.com/topic/56295-form-submit-to-itself-on-error/#findComment-278076 Share on other sites More sharing options...
monkeybidz Posted June 20, 2007 Author Share Posted June 20, 2007 Yes! Mainly input validation. Quote Link to comment https://forums.phpfreaks.com/topic/56295-form-submit-to-itself-on-error/#findComment-278077 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 if thats input validation and the validation will take place at the same page use php self then if the errors is fount do the echo thing and if theres no error the use the header file thing hope that helps am i on the right track in not tell me comment pls Quote Link to comment https://forums.phpfreaks.com/topic/56295-form-submit-to-itself-on-error/#findComment-278083 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.