Hi
Sorry if I've miseed this one in the forums - have been searching for some time and nothing really matches the problem I'm having.
I want to create a form that emails query to a different email address depending on what radio button is selected.
I'm finding that my submit button isn't working. It's the first time that I've tried to do this particular form and have only been building php for a week or so, so please go easy on me (I do have proper training booked) This is the first time my submit hasn't worked so I'm wondering if the code that controls the email array means that I have to change the submit code? Just a guess.
I've got the following html code:
<form method="POST" action="housekeeping_mailer.php">
<input name="Name" type="text" id="Name" size="20"\><br /><br />
<b>Email Address:</b><br />
<input name="Email" type="text" id="Email" size="20"\>
<p> <b>Mobile Number:</b><br />
<input name="Mobile" type="text" id="Mobile" size="20"\>
<p> <b>Dealer(FCS) Code:</b><br />
<input name="FCS" type="text" id="FCS" size="20"\>
<p> <b>Vehicle Registration:</b><br />
<input name="Reg" type="text" id="Reg" size="20"\>
<p>
<input type="radio" name="Query" value="Logistics" checked\>
<b>Logistics Query </b></p>
<input type="radio" name="Query" value="HPI"\>
<b>HPI Query </b></p>
<p>
<input type="radio" name="Query" value="V5"\>
<b>V5 Query </b></p>
<p align="left">
<textarea name="Textarea" cols="50" rows="5">Type your query here...</textarea>
<br /><br /><input type="submit" value="Submit" name="submit"></form>
and the following php code:
<?php
if(isset($_POST['submit'])) {
$name = $_POST["Name"];
$email = $_POST["Email"];
$mobile = $_POST["Mobile"];
$fcs = $_POST["FCS"];
$reg = $_POST["Reg"];
$subject = $_POST["Query"];
$logistics = $_POST["Logistics"]; //logistics
$HPI = $_POST["HPI"]; //hpi
$V5 = $_POST["V5"]; //v5
$message = $_POST["Textarea"];
$subject = "Housekeeping - $subject Query";
$emailgroup = $_POST["Query"];
$emailmessage = "Contacts Name: $name\nEmail Address: $email\nQuery Type: $subject\nQuery is: $message";
$email1 = "
[email protected]";
$email2 = "
[email protected]";
$email3 = "
[email protected]";
if ($emailgroup == "logistics")
{$messagesent = mail($email1, $subject, $emailmessage,"From: $email\r\n" . "Reply-To: $email");
include "./querysent.shtml";}
elseif
($emailgroup == "HPI")
{$messagesent = mail($email2, $subject, $emailmessage,"From: $email\r\n" . "Reply-To: $email");
include "./querysent.shtml";}
elseif ($emailgroup == "V5")
{$messagesent = mail($email3, $subject, $emailmessage,"From: $email\r\n" . "Reply-To: $email");
include "./querysent.shtml";}
else include "./queryfailed.shtml";
?>
Thanks in advance!