0

I have three pages as follows:

1> Form.php // users enter information, such as email, phone and is sent to registervalidate.php by POST method
2> registervalidate.php // validate the user entered information
3> welcome.php // print the user information back to the user

I need to redirect registervalidate.php to welcome.php if the user information is valid and print enter information on page welcome.php.

Here is question:

How do I transfer the posted data from form.php and send them to welcome.php from page registervalidate.php.

My working environment is XAMPP+MySQL+PHP+jQuery on windows machine.

Thank you

q0987
  • 34,938
  • 69
  • 242
  • 387

4 Answers4

3

You could use $_SESSION variables, then you have acces from anywhere ;-) But don't forget the session_start(); at first.

Tokk
  • 4,499
  • 2
  • 31
  • 47
1

You can do it with $_GET (don't do it) or do it with cURL.

Community
  • 1
  • 1
fabrik
  • 14,094
  • 8
  • 55
  • 71
  • Curl would be useless in this case anyways, as the OP wants the client to do the redirect. Curl would only be a server-server connection – Marc B Aug 23 '10 at 14:54
  • @Marc B: This means i cannot do a post request on the same server? – fabrik Aug 24 '10 at 06:16
  • You can, but if you're doing it to set a client cookie or pre-fill a form, it won't work, as the curl request is purely server-server. It does not involve the client at all. You have to store the data elsewhere, either in get query parameters, or a server-side session. – Marc B Aug 24 '10 at 14:15
1

I would store the variables in a session, and then forward the user on, making sure the form now checks $_SESSION as well as $_POST

Kevin Sedgley
  • 1,049
  • 1
  • 11
  • 22
  • There is a problem by directly using this method. I want to let the user login first after successfully finishing registration. If I use $_SESSION to redirect to welcome.php, then I need to first check $_SESSION, then print the info and then destroy session. So that the user can see the welcome confirmation however it has been logout already. does this make sense to you? Thank you – q0987 Aug 23 '10 at 14:41
  • use post for the communication from From.php to registervalidate.php, and if the validation was succesfull open the session, save the information in the session and then go to welcome.php (e.G. per header()) – Tokk Aug 23 '10 at 14:44
0

I would use javascript so

//your validation stuff...

if($valid)
{
    echo("<script language=\"javascript\">location.href=\"welcome.php?myvar1=".$myVar1"\";</script>");
}

edits... I suck at formatting

Dai
  • 1,510
  • 1
  • 11
  • 12