I
IB noob
Guest
Sorry for the very long extra information but I thought I should include everything that is relevant. Ignore missing <br /> tags, I removed them as they took effect in the question layout.
I'm in the process of making a simple website (my first ever website) for IB students with links to various study notes and similar things...
I've created a "Submit link" page in which I want a form with several fields that when submitted is sent to my email (see code below).
My problem is I don't know how to include multiple fields into the body of the email (I wrote my current code based on a tutorial which only showed how to include one field into the email body).
Here is the form code:
<!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="sendmail2.php">
Your name:
<input type="text" name="name" size="25">
Your e-mail adress:
<input type="text" name="email" size="25">
Link you wish to submit:
<input type="text" name="link" size="40">
Subject(s) to which the link is relevant
<input type="text" name="link" size="40">
<input type="radio" name="level" value="HL">HL
<input type="radio" name="level" value="SL">SL
<input type="radio" name="level" value="Both">Both
Short descripton of link (optional):
<input type="text" name="description" size="40">
<input type="submit" />
<?php include 'footer.html' ; ?>
</form>
</body>
</php>
And here is the send mail page code:
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['level'] ;
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
I tried some of peoples suggestions such as:
Replacing send mail code with this:
<?php
email = $_POST['email'];
$message = $_POST['name'] . "<br />" . $_POST['link'] . "<br />" . $_POST['level'] . "<br />" . $_POST['description'];
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
But I get this error:
Parse error: syntax error, unexpected '=' in /home.42/i/b/n/ibnoobs/www/sendmail.php on line 2
I also tried replacing send mail page with this:
<?php
$email = $_REQUEST['email'] ;
$link = $_REQUEST['link'] ;
$subject = $_REQUEST['subject']
$level = $_REQUEST['level'];
$desc = $_REQUEST['description'];
$message = "Subject: ".$subject."\nLink: ".$link."\nLevel: ".$level."\n\n".$desc;
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
But I get the following error:
Parse error: syntax error, unexpected T_VARIABLE in /home.42/i/b/n/ibnoobs/www/sendmail.php on line 5
I'm in the process of making a simple website (my first ever website) for IB students with links to various study notes and similar things...
I've created a "Submit link" page in which I want a form with several fields that when submitted is sent to my email (see code below).
My problem is I don't know how to include multiple fields into the body of the email (I wrote my current code based on a tutorial which only showed how to include one field into the email body).
Here is the form code:
<!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="sendmail2.php">
Your name:
<input type="text" name="name" size="25">
Your e-mail adress:
<input type="text" name="email" size="25">
Link you wish to submit:
<input type="text" name="link" size="40">
Subject(s) to which the link is relevant
<input type="text" name="link" size="40">
<input type="radio" name="level" value="HL">HL
<input type="radio" name="level" value="SL">SL
<input type="radio" name="level" value="Both">Both
Short descripton of link (optional):
<input type="text" name="description" size="40">
<input type="submit" />
<?php include 'footer.html' ; ?>
</form>
</body>
</php>
And here is the send mail page code:
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['level'] ;
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
I tried some of peoples suggestions such as:
Replacing send mail code with this:
<?php
email = $_POST['email'];
$message = $_POST['name'] . "<br />" . $_POST['link'] . "<br />" . $_POST['level'] . "<br />" . $_POST['description'];
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
But I get this error:
Parse error: syntax error, unexpected '=' in /home.42/i/b/n/ibnoobs/www/sendmail.php on line 2
I also tried replacing send mail page with this:
<?php
$email = $_REQUEST['email'] ;
$link = $_REQUEST['link'] ;
$subject = $_REQUEST['subject']
$level = $_REQUEST['level'];
$desc = $_REQUEST['description'];
$message = "Subject: ".$subject."\nLink: ".$link."\nLevel: ".$level."\n\n".$desc;
mail( "[email protected]", "Reported Link",
$message, "From: $email" );
header( "Location: ./thankyou.html" );
?>
But I get the following error:
Parse error: syntax error, unexpected T_VARIABLE in /home.42/i/b/n/ibnoobs/www/sendmail.php on line 5