Jump to content


Photo

how do i redirect back a page with $_POST vars??


  • Please log in to reply
2 replies to this topic

#1 just-j

just-j
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 18 July 2006 - 03:07 AM

ok  when someone submits a form then it goes to the .php page and checks the information they submited..  so if some info is wrong i.e, the password and retyped password dont match, then i want to go back to the form page and send some post vars and stop the php page from doing any more.  how do i do this??

#2 scott212

scott212
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 18 July 2006 - 03:16 AM

I'm not sure what others will say, but I approach that situation a little differently. I do the majority of my form processing for a page at the top of that page inside of an 'if' statement to see if the button name is valid (i.e. if the form was submitted). During the form processing at the top of the page, should the script fail a conditional, you just exit out and it continues on with the page. It also makes it really easy to pass feedback to the rest of the page about what went wrong. Cheers!

#3 emehrkay

emehrkay
  • Staff Alumni
  • Advanced Member
  • 1,214 posts

Posted 18 July 2006 - 04:15 AM

im sorry that i dont know the exact methods, but you need to use the header function

first defining the cache-control to allow for the form data to keep the form populated

then in your processing php page, before anything is outputted to the browser, you check to see if the passwords match. if they dont you do a header("location: ") call




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users