Send info to next page..

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
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Send info to next page..

Post 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]
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Ok..

Post 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.
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post 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!
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post 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).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: Ok..

Post 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...
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

I would use sessions, only because theyre more secure, and can be carried across many pages.

:arrow: Sessions
Post Reply