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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.