I have been using php to try and email the user entered content from a web form to an email address. Been messing around with the php code to no avail. Here's the web form:
<form action="form2email.php" method="post">
<div id="problem" class="fluid">
<textarea name="problem" cols="50" rows="4" placeholder="enter problem here" row="4"></textarea>
</div>
<div id="email" class="fluid">
<input type="email" name="email" placeholder="email optional">
</div>
<div id="userOptions" class="fluid">
<label for="yes">Yes</label>
<input name="publish" type="radio" value="Yes">
<label for="no">No</label>
<input type="radio" name="publish" value="No">
<label for="responder"><b>Michael</b></label>
<input name="responder" type="checkbox" value="Michael" id="responder">
<label for="responder"><b>Jennifer</b></label>
<input type="checkbox" name="responder" value="Jennifer" id="responder">
<label for="responder"><b>Mei</b></label>
<input type="checkbox" name="responder" value="Mei" id="responder">
<label for="responder"><b>Random</b></label>
<input type="checkbox" name="responder" value="Random" id="responder">
</div>
<div id="submit" class="fluid">
<input type="submit" value="Submit">
</div>
</form>
and here's the php:
<?php
$emailBody= 'problem: '.$_POST['problem']."\n".
'email: '.$_POST['email']."\n".
'publish: '.$_POST['publish']."\n".
'responder: '.$_POST['responder']."\n"
if(isset($_POST['submit'])) {
mail('[email protected]', 'problem' , $emailBody);
header('location: thankyoupage.HTML');
}
else{
header('location: testing.html');
}
?>
The problems vary when I mess around with the code but it always has a problem with everything after the variable. The only way not to generate an error message is by making th variable at the end of the if else statements.
In this case shown above the form wont work at all it just takes me to a page that says "Object not found error 404". And on the php file it says there's an unexpected T_if but if I put a semi-colon at the end of the variable the script doesn't work at all. Help will be much appreciated and thank you in advance.