Hi all,
I am trying to setup a “contact us” page on my site and have come upon a problem I can’t fix.
I want 5 destination email addresses picked by radio buttons. In the main it is working OK, but no matter which destination you pick the email always goes through to the last one
webmaster@mydomain.com.
The emails I receive when I test the form have the correct info, Enquiries if I pick enquiries or Sales if I pick sales, but always come through to the webmaster address.
I expect it is something quite simple because if I change the last email on the list to
enquiries@mydomain.com all the mails come through to that address. Could someone have a look at my code and set me straight.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--
function get_radio_value()
{
for (var i=0; i < 5; i++)
{
if (document.email.mail[i].checked)
{
var rad_val = document.email.e-mail[i].value;
}
}
}
//-->
</SCRIPT>
</head>
<body>
<table align="center" width="99%" border="1" cellpadding="5" cellspacing="1"> <form name="email" method="POST" action="../cgi-bin/formmail/formmail.cgi">
<td width="742" height="28">Speak to us about an existing order.</td>
<td width="150"><input type="radio" name="mail" value="Orders">
<inputtype="hidden"name="recipient"value=orders@my domain.com>
<b>Orders</b></td>
</tr>
<tr>
<td height="28">Talk to us about a past order.</td>
<td><input type="radio" name="mail" value="Sales">
<input type="hidden" name="recipient" value="sales@mydomain.com">
<b>Sales</b></td>
</tr>
<tr>
<td height="28">Mail us about anything related to mydomain.com</td>
<td><input type="radio" name="mail" value="Enquiries">
<input type="hidden" name="recipient" value="enquiries@mydomain.com">
<b>Enquiries</b></td>
</tr>
<tr>
<td height="28">Talk to our current featured artist.</td>
<td><input type="radio" name="mail" value="Joe">
<input type="hidden" name="recipient" value="joe@mydomain.com">
<b>Joe</b></td>
</tr>
<tr>
<td height="28">Inform us about any problems on this site.</td>
<td><input type="radio" name="mail" value="WebMaster">
<input type="hidden" name="recipient" value="webmaster@mydomain.com">
<b>WebMaster</b></td><br><br>
</tr>
<tr>
<td height="184" colspan="2" align="center" valign="top">
<table border='0' cellspacing='1' cellpadding='1' width='250'>
<tr>
<td width="100%" align="center"><br><font color="#FF0000">*</font>
Your Name:<input type="text" name="realname" size="30"><br><br>
<font color="#FF0000">*</font>Your Email:<input type="text" name="email" size="30"><br><br>
Subject:<input type="text" name="subject" size="81"><br>
Your Comments:<br><textarea name="comments" cols="70" rows="7"></textarea></td>
</tr>
</table><font size="1" color="#FF0000">*required</font>
</td>
</tr>
</table><br><center>
<input type="submit" name="Send" value=" Send " onClick="get_radio_value()"></center>
<input type="hidden" name="posted" value="1">
<input type="hidden" name="required" value="realname,email,comments">
<input type="hidden" name="redirect" value="http://www.mydomain.com/contact_us_submission.php">
</form><br><br>
</td>
</tr>
</table>
</body>
</html>
Thanks for your help,
Regards
PieMan
