Hey guys.
Im working on my first website project for my sister and finally managed to get a basic contact form working on the site. The problem is, my hosting company supplied me with the PHP files but I cannot work out how to add extra fields and check boxes into the form.
I currently have three available fields - Name, Email and a text area, but I need to add at least one extra field and three check boxes which are sent to my email in text format (the same way i'm receiving the data now)
mail.php code...
<?php
$to = 'example@example.com';
$subject = 'subject';
$message = 'From: ' . $_REQUEST['name'] . "\n\n" . $_REQUEST['data'];
$email = $_REQUEST['email'];
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
ini_set("sendmail_from", $email);
mail ($to, $subject, $message, $headers, "-f".$email);
header("Location: http://www.example.com/page.html");
?>
and a rough example of the HTML im using...
sendmail.php code...
<form method="post" action="mail.php">
Name:
<input type="text" name="name" />
E-mail:
<input type="text" name="email" />
Comments:
<textarea name="data" cols=40 rows=6></textarea>
<td colspan="2"><input type="submit" /></td><br />
</form>
Basically, I need to add a 'Lift Sharing' page to a Wedding website. Anyone who can offer a lift, enters their details and the data will be displayed for anybody to contact them.
This is literally my first dabble into PHP so I havent got a clue what im doing. Again, the contact form itself is working just fine because my host set it up for me.
Can anyone maybe show me how to create a setup which sends data with 4 fields and 3 check boxes....
Would be very much appreciated, of course 😃