Noob needs help with form sent to email
Posted: Mon Jan 26, 2009 7:21 am
Hi,
I'm totally new to HTML, PHP and Javascript (only started learning a couple of days ago).
I've set up a simple website (http://start10g.ovh.net/~ibnoobs/) which contains links to resources for students doing the IB diploma.
What I need help with is a simple "Submit a link" form which I have already set up. My problem is that I don't know how to include more than 1 field into the body of the email that is sent to me when a person submits a link. I would ideally like to have a form containing 6 fields (see http://start10g.ovh.net/~ibnoobs/submit.php) one of them being a choice between 3 radio buttons.
The form is set up in 2 pages, one containing the actual form and the other the code that mails the form. So how do I get the data from all 6 fields into the body of the email.
Here is the code for my two pages:
form page:
<!Doctype: php>
<head>
<title>Submit a link</title>
</head>
<body>
<?php include 'template.html' ; ?>
<h3> Submit a link to IBnoobs.com </h3>
<form method="post" action="sendmail.php">
Your name:<br />
<input type="text" name="name" size="25">
<br />Your e-mail adress:
<br /><input type="text" name="email" size="25">
<br />Link you wish to submit:
<br /><input type="text" name="link" size="40">
<br />Subject(s) to which the link is relevant
<br /><input type="text" name="link" size="40">
<br /><input type="radio" name="level" value="HL">HL
<br /><input type="radio" name="level" value="SL">SL
<br /><input type="radio" name="level" value="Both">Both
<br />Short descripton of link (optional):
<br /><input type="text" name="description" size="40">
<br /><br />
<input type="submit" />
<br />
<br />
<br />
<?php include 'footer.html' ; ?>
</form>
</body>
</php>
send mail page:
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['level'] ;
mail( "postmaster@ibnoobs.com", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
Thanks in advance.
I'm totally new to HTML, PHP and Javascript (only started learning a couple of days ago).
I've set up a simple website (http://start10g.ovh.net/~ibnoobs/) which contains links to resources for students doing the IB diploma.
What I need help with is a simple "Submit a link" form which I have already set up. My problem is that I don't know how to include more than 1 field into the body of the email that is sent to me when a person submits a link. I would ideally like to have a form containing 6 fields (see http://start10g.ovh.net/~ibnoobs/submit.php) one of them being a choice between 3 radio buttons.
The form is set up in 2 pages, one containing the actual form and the other the code that mails the form. So how do I get the data from all 6 fields into the body of the email.
Here is the code for my two pages:
form page:
<!Doctype: php>
<head>
<title>Submit a link</title>
</head>
<body>
<?php include 'template.html' ; ?>
<h3> Submit a link to IBnoobs.com </h3>
<form method="post" action="sendmail.php">
Your name:<br />
<input type="text" name="name" size="25">
<br />Your e-mail adress:
<br /><input type="text" name="email" size="25">
<br />Link you wish to submit:
<br /><input type="text" name="link" size="40">
<br />Subject(s) to which the link is relevant
<br /><input type="text" name="link" size="40">
<br /><input type="radio" name="level" value="HL">HL
<br /><input type="radio" name="level" value="SL">SL
<br /><input type="radio" name="level" value="Both">Both
<br />Short descripton of link (optional):
<br /><input type="text" name="description" size="40">
<br /><br />
<input type="submit" />
<br />
<br />
<br />
<?php include 'footer.html' ; ?>
</form>
</body>
</php>
send mail page:
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['level'] ;
mail( "postmaster@ibnoobs.com", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
Thanks in advance.