Hello, I am pretty new to PHP, and I had gotten a friend to help me write a php form.
I have everything set how I need it to be, but I am missing a few important things.
Users can just hit submit, and a blank message will be sent. I also have an agreement checkbox, which users can ignore, as the message will send even if it is not checked. Lastly, I need the page to display a "success message" when they hit submit.
Here is the code I have so far:
<!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">
<?php
if($_POST['emailSub']) {
$to = "baftub@gmail.com";
$subject = "Blog Application";
$message = "Firstname:\t" . $_POST['firstname'] .
"\nLastname:\t" . $_POST['lastname'] .
"\nEmail:\t" . $_POST['email'] .
"\nitem:\t" . $_POST['item'] .
"\ncomment:\t" . $_POST['comment'];
mail($to, $subject, $message);
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Content Submission</title>
<style type="text/css">
<!--
body {
background-color: #121212;
}
body,td,th {
color: #FFF;
}
-->
</style></head>
<body>
<center>Please fill out this form for any content you wish to contribute
<br />
<br />
<br />
<form name="input" action="" method="post">
First name:
<input type="text" name="firstname" />
<br />
<br />
Last name:
<input type="text" name="lastname" />
<br />
<br />
Email:
<input type="text" name="email" />
<br />
<br />
Which item are you going to contribute to?
<input type="text" name="item" />
<br />
<br />
Please provide further details for your submission, any pictures or files.
<br />
<textarea cols="50" rows="4" name="comment"></textarea>
<br />
<br />
I agree that content submitted by myself is created by me, and does not breach any copyrights
<br />
<input type="checkbox" name="yes" value="yes" />
<br />
<br />
<input type="submit" name="emailSub">
</form>
</center>
</body>
</html>
Thank you for the help :)