Form Redirect

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

whoiskb
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Jan 10, 2003 9:32 am
Contact:

Form Redirect

Postby whoiskb » Fri Jan 10, 2003 9:39 am

ASP programmer going PHP.

I just got a new web host and all they support is PHP. I am going to learn PHP, but I need a quick script to help me with something and was wondering if one of you could help me out.

What I want to do is submit a form to a php script and redirect the contents to another page to acutally handle the data that is sent through the form post.

Example:
abc.htm --POST--> script.php --redirect post--> SomeSite

SomeSite will actually process the form data for me....

Now in the IIS/ASP world I would be able to use server.transfer to do this. How would I do this in PHP?

Thanks for your help.
Kevin Blakeley

sarah
New php-forum User
New php-forum User
Posts: 4
Joined: Fri Jan 10, 2003 8:11 am

Postby sarah » Fri Jan 10, 2003 10:12 am

Is there a problem with just putting SomeSite in the action of the form?

Code: Select all

<form name="form1" method="post" action="SomeSite">

whoiskb
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Jan 10, 2003 9:32 am
Contact:

Postby whoiskb » Fri Jan 10, 2003 12:30 pm

Here is what I am using this for. An affiliate program sent me a form to put on my website for people to sign up on. Well I am also going to include this form into some of the emails I send out to my newsletter subscribers. When the user fills out the form in the email and hits submit, I want the script.php page so that I can track if people are using the form within the email. I figure the easiest way would be to run the form post through a php script on my server and then just check my stats to see how many hits that script gets.

Is this not possible to do in PHP???

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Fri Jan 10, 2003 1:06 pm

I would do it like this:
The form:

Code: Select all

<form name="form1" method="post" action="SomeSite.php">
<input type="text" name="name" value="Joan">
<input type="submit">
</form>


SomeSite.php:

Code: Select all

echo $HTTP_POST_VARS["name"];//outputs Joan


This is the basics, then you can use it as you want.
bye!

whoiskb
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Jan 10, 2003 9:32 am
Contact:

Postby whoiskb » Fri Jan 10, 2003 1:16 pm

I don't think this is what I am after. I don't want to do anything with the data except pass it off to the affiliates site so their scripts can process for post data.

Thanks
KB

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Fri Jan 10, 2003 3:28 pm

Well, this is exactly what you are doing.
You are sending the POST data in a header and the script will have to deal with those variables.

The script in the middle could have a javascript onload function, so users don't need to press any buttons.

You can do whatever you want with those vars.
Obviusly you'll need to know how the script (where you are sending those vars) works.

If you post something concrete maybe we'll give you a more appropiate answer.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron