Jump to content

Adding email address into a form


dunn_cann

Recommended Posts

Could someone please help me out here? I have been trying to include an email address/url into a form so that i could if wanted send the results of the form to a colleague for example. Thanks all.

HTML Code:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Feedback Form</title>
</head>
<body>
<u>Please complete this form to submit your feedback:</u> <br />

<form action="handle_form.php" method="POST">

Mr. <input type="radio" name="title" value="Mr." />
Mrs. <input type="radio" name="title" value="Mrs." />
Ms. <input type="radio" name="title" value="Ms." />
<br />
Name: <input type="text" name="name" size="20" />
<br />
Email Address: <input type="text" name="email" size="20" />
<br />
Response: <select name="response">
<option value="excellent">This is excellent.</option>
<option value="okay">This is okay.</option>
<option value="boring">This is boring.</option>
</select>
<br />
Comments: <textarea name="comments" rows="3" cols="30"></textarea>
<br />
<input type="submit" name="submit" value="Send My Feedback" />

</form>

<!-- Feedback.html -->
</body>
</html>


PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Practice Page</title>
</head>
<body>
<?php // Script 3.4 - handle_form.php

ini_set ('display_errors',1); // Let me learn from my mistakes.

// This page receives the data from feedback.html.
// It will receive: title, name, email, response, comments, and submit.

print "Thank you {$_POST['title']} {$_POST['name']} for your comments. <br />";
print "You stated that you found this example to be {$_POST['response']} and added: {$_POST['comments']}";
?>
</body>
</html>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33139-adding-email-address-into-a-form/
Share on other sites

if you read the manual for teh mail function that jessie gave you a link to you should get a good starting point. People on here will HELP you not do it for you.

Tell us what you have messed up, post some error messages or something then we can HELP.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.