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!
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:
<?
$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.
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]
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.
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).
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:
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.