Auto send "get" request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Hillsey
Forum Newbie
Posts: 4
Joined: Fri May 05, 2006 4:07 am

Auto send "get" request

Post 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,
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

how about something like

Code: Select all

header("Location: somePage.php?var1=foo&var2=bar");
Hillsey
Forum Newbie
Posts: 4
Joined: Fri May 05, 2006 4:07 am

Post 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.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

it would be just as you described it
Hillsey
Forum Newbie
Posts: 4
Joined: Fri May 05, 2006 4:07 am

Post by Hillsey »

Great,

Everything works as I wanted

Thanks for your help mate,

Dave.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Which browsers?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Hillsey
Forum Newbie
Posts: 4
Joined: Fri May 05, 2006 4:07 am

Post 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.
Post Reply