Page 1 of 1

Auto send "get" request

Posted: Fri May 05, 2006 4:34 am
by Hillsey
Hi,

Just wondering if anyone can give me some advise, I currently have the following process in place.

1. A get request is sent to my server
2. I use the data to query a database
3. The results of the query are used to populate some fields in a form
4. A piece of Java script is used to auto submit the form.

At present I only use steps 4 and 5 as once the request comes into my server I need to process this and in return send a 'get' request back.

What I would ideally like to do is generate the return 'get' request without having to use a form and the Java script as I think the script is causing problems sometimes.

I would be geateful if anyone could offer some advise.

Cheers,

Posted: Fri May 05, 2006 4:38 am
by JayBird
how about something like

Code: Select all

header("Location: somePage.php?var1=foo&var2=bar");

Posted: Fri May 05, 2006 5:35 am
by Hillsey
Pimptastic wrote:how about something like

Code: Select all

header("Location: somePage.php?var1=foo&var2=bar");
Pimptastic thanks for that, can't believe something so simple!

Just one other question if I may, if I wanted var1 and var2 to equal variables rather then a predefined words how would the code look? e.g. would it be var1='$name'&var2='$name'); or something different

thanks again.

Posted: Fri May 05, 2006 5:57 am
by JayBird
it would be just as you described it

Posted: Fri May 05, 2006 7:11 am
by Hillsey
Great,

Everything works as I wanted

Thanks for your help mate,

Dave.

Posted: Fri May 05, 2006 10:55 am
by feyd
make sure to use the full URL for the script being called. Some browsers do not understand relative redirection URLs because it's non-standard.

Posted: Fri May 05, 2006 11:00 am
by s.dot
Which browsers?

Posted: Fri May 05, 2006 11:44 am
by Hillsey
feyd wrote:make sure to use the full URL for the script being called. Some browsers do not understand relative redirection URLs because it's non-standard.
Hi,

In regards to the above does this simply mean this;

header("Location: http://www.server.com/somePage.php?var1=foo&var2=bar");

Or do I need to do something else as well?

Cheers.