Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Automatic posting varibles to another page while doing a redirect



10:36 am on Aug 26, 2004 (gmt 0)

10+ Year Member

Hi I'm trying to automacticly post 2 varibles from one script to another. I have a form with an email & password field. I pass that to another page which has to redirect and post the varibles it collected to a final page where the user will be logged in. It's going from two php scripts to a propioraty system. I know it's a round about way to do it but it's the only way I can think of. How would I go about doing this? Thanks



12:30 pm on Aug 26, 2004 (gmt 0)

10+ Year Member

You could do this in several ways...

Let's say that page1 sends usr+psw to page2
Page 2 will to whatever, and this page will call the
page3 passing the usr+psw+whatever to page3.

(at least that's what I have understood on your request)

So page2 could call page3 in:

. JavaScript onLoad="..." function that will submit your form. But this makes no javascript people away. (hotmail does too)

. <META HTTP-EQUIV=Refresh CONTENT="0; URL=http://site.com/page3.php?var1=123&var2=123">
The bas side of this is that variables are then seen in the url field. But a hashing of them, or even encrytion can solve that issue.

. header("Location: [site.com...] This will work in all browsers, but has the same problem as above.

And finally, another sollution is to use cookies. Then page 3 will read them. This makes the use to have cookies support.

Hope it helps.
Regards, Ethan.


12:55 pm on Aug 26, 2004 (gmt 0)

10+ Year Member

Thanks for the responce. Thats what I mean but the thing is I have no control over page 3. It's a lotus mail account and it doesn't use cookies. I don't have access to it and the varibles have to be post not get. Basically I substituting the lotus mail login for my own login page. Do you see what I'm getting at.

I was thinking of using a header redirect or something similar so I could avoid the whole javascript issue and I can't use get method because the thrid page won't accept the varibles. Is there another way?


3:54 pm on Aug 26, 2004 (gmt 0)

10+ Year Member

Then the best method I can think to make the user browser send the variables to page3 with POST method is a javascript onLoad event to body, that will send a form with hidden fields. Then also have support for no javascript users so let them see a "continue button" that would be the submit button for the form...

something like...

<form name="gateway" action="page3.php" method="POST">

<input type="hidden" name="var1" value="123">
<input type="hidden" name="var2" value="123">
<input type="hidden" name="var3" value="123">

<input type="submit" value="continue to login">

add the event to body.. onLoad="document.gateway.submit();"

And this should run transparently for javascript users, and still usable for non javascript ones.

Good luck ;)


4:18 pm on Aug 26, 2004 (gmt 0)

10+ Year Member

Thanks. I'm going to see if I can come up with something. Although javascript seems the only way.


1:18 pm on Aug 28, 2004 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You could use PHP session handling [php.net] to store the userid and pwd info server-side, then make your own POST to the mail login with PHP's header() [php.net] function.


11:50 pm on Aug 29, 2004 (gmt 0)

10+ Year Member

I hate using javascript for anything.

I make use of header("Location: newpage.php")

as well as making calculations in a php page, then including() another page within it. My php.ini is setup to buffer everything so that I can set cookies/sessions at any time during the process.


8:49 am on Aug 30, 2004 (gmt 0)

10+ Year Member

Thanks for the replies. So using a header redirect would be the best thing. Then how do I go about sending the post info. I'm going to have a look at url_rewriter.tags and see if that would work.

For the time being I was going to write some javascript to do the redirect and see how that goes.


Featured Threads

Hot Threads This Week

Hot Threads This Month