Forum Moderators: coopster

Message Too Old, No Replies

Using two form actions on a single form..

Is it possible?

         

megajam02

3:08 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



I have a survey form for users to fill out. I would like for the form to do two things -

1 - Send me an email with their responses.
2 - Take them to a results page that shows them content regarding what they answered in the form.

My setup so far:
I'm designing in php. My host is using FormMail.cgi to send the emails (I can't change this). My results page is using the


$_POST['value']

function to determine what results to display.

My issue is this: When using the POST method in my survey form, my results page works wonderfully. It sees all the form field values passed from the form, and processes my if/else statements correctly. Now, if I configure my form action to POST to FormMail.cgi, and I use my results page as the redirect, will the POST values move to the results page, or are they dropped immediately upon FormMail processing the POST values?

I hope this rambling makes sense.
Thanks,
Chris

timster

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

WebmasterWorld Senior Member 10+ Year Member



Is there a reason you need to use FormMail? It's easy enough to have PHP send the email and then return the results page.

A redirect isn't going to send along the post data. If the data is short, however, you may be able to put it into the querystring of your redirect.

megajam02

4:33 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



I suppose I don't have to have FormMail send the email, I'm just not good enough with PHP to have it send the email instead of FormMail.

I am currently working on inserting the form values into the redirect URL, but I haven't had any luck so far.

Here is the last one I tried (that didn't work)


hxxp://www.sitename.com/test/results.php?q1=<?php echo $_POST['q1']?>&q2=<php echo $_POST['q2']?>

I can't figure out where I'm going wrong..

timster

1:33 pm on Aug 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you put the data into the querystring of the redirect URL, the data won't be available in PHP's $_POST variable.

You can find it in the $_GET variable. If you want PHP to check both POST and GET data, use the $_REQUEST variable.

Does that help?

megajam02

2:31 pm on Aug 9, 2004 (gmt 0)

10+ Year Member



I dont know exactly what you mean, but I will start doing some research on the Request variable and try to figure it out.

I'm sure there is some good documentation out there..

Thanks
Chris

mincklerstraat

3:44 pm on Aug 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Go for the mail with php option. It's really very, very easy - check out the function mail() in the manual and you'll see what I mean. [be2.php.net...]
Just a tiny bit harder than echo "hello world";