Jump to content

$_POST variables


thomashw

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.