php - how to use single submit button for postback and redirecting to a new page based on the validations from the page -


i have page written using html , php input fields , submit button. how can use submit button on page postback in case of errors after validations performed , use same button redirect new page when there no errors? tried using header(location: "") function redirect new page want data entered in input fields on page posted on redirected page.

is there way can use 2 html forms in single page? if yes how can done using single submit button.

you can use single form! assume you're aware form attribute called action. <form action="foobar.php"...

the foobar.php handle validation , can store user input in sessions can echo them text fields follows:

$oldvalue = (isset($_session['username']))? $_session['username'] : '';  <input type="text" name="username " value="$oldvalue"> 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -