thomashw Posted March 23, 2008 Share Posted March 23, 2008 If I have a form that submits to a certain page, and this page redirects to another page depending on what a user selected on the form, will the $_POST variables from the initial page also be redirected? Or is there a way to redirect them while keeping them in the $_POST variable? I can't use sessions or anything. Thanks! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 23, 2008 Share Posted March 23, 2008 depends how your redirecting, but simply put no.. you could use CURL or fsockets to make a connection to another site with the POST, if you control the site you have a fw more options but as you said you can't use sessions i guess their remote Quote Link to comment Share on other sites More sharing options...
thomashw Posted March 23, 2008 Author Share Posted March 23, 2008 Yeah, the site being redirected to is remote. Hmm... Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 23, 2008 Share Posted March 23, 2008 you could try a javascript solution, if you know the fields to post then have the form with the fields and change the action to the remote path and then have JS submit it Quote Link to comment Share on other sites More sharing options...
sqlnoob Posted March 23, 2008 Share Posted March 23, 2008 depends how many choices the user has. otherwise you could try it with a switch statement or an if-else construction like: $userpassword = $_POST["password"]; if ($userpassword == something) echo "<a href='somelink.htm'>back</A>"; else echo "<a href='anotherlink.htm'>back</A>"; to give you an example Quote Link to comment Share on other sites More sharing options...
sqlnoob Posted March 23, 2008 Share Posted March 23, 2008 I once made an html page with javascript this way: <HTML> <HEAD> <TITLE>password checking</TITLE> <META NAME="keywords" CONTENT="entrance"> <script type="text/javascript"> var password; var pass1 = "somepassword"; // place password here password=prompt("Please enter your password:",""); if (password==pass1) { window.location= "http://www.goodpage.htm"; // file to open if password is correct } else { window.location= "http://www.badpage.htm"; // file to load if password is incorrect } </script> </HEAD> <BODY> </BODY> </HTML> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 24, 2008 Share Posted March 24, 2008 I once made an html page with javascript this way: <HTML> <HEAD> <TITLE>password checking</TITLE> <META NAME="keywords" CONTENT="entrance"> <script type="text/javascript"> var password; var pass1 = "somepassword"; // place password here password=prompt("Please enter your password:",""); if (password==pass1) { window.location= "http://www.goodpage.htm"; // file to open if password is correct } else { window.location= "http://www.badpage.htm"; // file to load if password is incorrect } </script> </HEAD> <BODY> </BODY> </HTML> That wont be secure. As the password can see from the source code and it can be bypassed by disabling javascript. If you want to keep passwords private then use PHP Quote Link to comment Share on other sites More sharing options...
thomashw Posted March 24, 2008 Author Share Posted March 24, 2008 I was able to have ONE $_POST variable be sent back to me once the person comes back to my site. I used this variable to contain the SID, and reestablished the session once they returned. Quote Link to comment 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.