Page 1 of 1

Send info to next page..

Posted: Wed Sep 06, 2006 11:19 pm
by gkwhitworth
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Ok here is my code:

Code: Select all

<?
	$email = $_REQUEST['email'];
	$name = $_REQUEST['name'];
	$phone = $_REQUEST['phone'];
	$contact = $_REQUEST['contact'];
	$comments = $_REQUEST['comments'];
	
	ini_set("SMTP","127.0.0.1");
	
	if (empty($name) || empty($email)) {
	?>
		
	<html>
    <head><title>Error</title></head>
    <body>
    <h1>Error</h1>
    <p>
    Oops, it appears you forgot to enter either your
    email address or your message. Please press the BACK
    button in your browser and try again.
    </p>
    </body>
    </html>
	
	<?
	}	
	else {
		mail("contact@gkwinspired.com", "Feedback Form Results" , "name: $name\nPhone: $phone\nContacting Who: $contact\nComments:\n$comments", 
		"From: $name <$email>");
		header ("Location: http://www.gkwinspired.com/feedback.htm");
		}			
?>
This code currently emails me the form information. I plan on making the form more in depth allowing the user to select different options and I want them to be able to view what they selected once they submit the form. I know that this can be accomplished by using my varaibles on the next page but all I get are the following: '$name' instead of 'John Doe.' So the question is: am I not able to send an email as well as send their information to the next page? Does the Request have to be Post in order to make this possible. Remember, I still want to get the email.

Greg


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Ok..

Posted: Thu Sep 07, 2006 12:30 am
by gkwhitworth
11 people have looked at my post and no help at all. I must assume that I made this question too difficult. All I want to do is the following:

Code: Select all

You select option 1 in the form, you are then taken to a page that says: you have selected option 1.  An email is also sent to me (the webmaster) stating: they chose option 1.

Code: Select all

Hope that paints an easier picture.

Posted: Thu Sep 07, 2006 2:20 am
by andym01480
2 ways. Use session variables or put the variables in the url

header ("Location: http://www.gkwinspired.com/feedback.htm ... e2=$value2");

Using sessions is preferred as it is more secure, people can add or change the values in a url!

Posted: Thu Sep 07, 2006 2:44 am
by Mordred
andym01480 wrote:2 ways. Use session variables or put the variables in the url

header ("Location: http://www.gkwinspired.com/feedback.htm ... e2=$value2");

Using sessions is preferred as it is more secure, people can add or change the values in a url!
Method 3: use input type="hidden", which will work if the form is GET or POST.

You are partly right about sessions, but still you have to check all input after step 1, and if you do this with a function, it's not a problem to check them after step 2 as well (therefore using just the hidden vars without the overhead of sessions).

Re: Ok..

Posted: Thu Sep 07, 2006 7:39 am
by feyd
gkwhitworth wrote:11 people have looked at my post and no help at all. I must assume that I made this question too difficult. All I want to do is the following:

Code: Select all

You select option 1 in the form, you are then taken to a page that says: you have selected option 1.  An email is also sent to me (the webmaster) stating: they chose option 1.

Code: Select all

Hope that paints an easier picture.[/quote]You waited all of an hour...

Posted: Thu Sep 07, 2006 2:26 pm
by nickman013
I would use sessions, only because theyre more secure, and can be carried across many pages.

:arrow: Sessions