Hi,
Im using an email contact form script (I'll paste it below) and i want to have the "$subject" (which currently isnt defined at all) defined by the user choosing one of a selection of radio buttons.
Could someone help me with this please? THANKS[/B]
[FONT=Courier New]<?
if ($style == 1) {
echo "<link href=\"contact_style.css\" type=\"text/css\" rel=\"stylesheet\">";
}
function docheck( $email )
{
if (eregi("0-9a-z@0-9a-z\.[a-z]{2,4}$", $email, $valid))
{
if (getmxrr( substr(strstr($valid[0], '@'), 1),$mxhosts))
{
return true;
}
}
return false;
}
if ($submit) {
if ($name == "") {
$error = "Please fill out your name";
}
else if ($email == "") {
$error = "Please enter your email address.";
}
else if (!docheck($email)) {
$error = "The format of your email doesn't appear to be valid";
}
else if ($message == "") {
$error = "Please enter a message";
}
if ($error) {
echo "<table align='center' width='380' cellspacing='0' cellpadding='10'>";
echo "<tr><td align='center'>";
echo "<font color='#C00020'>$error</font><br><br><a href='javascript:history.go(-1)'>< click to continue ></a>";
echo "</td></tr></table>";
}
else {
@extract($_POST);
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$message = stripslashes($message);
mail($to,$subject,$message,"From: $name <$email : $ip>");
echo "<table align='center' width='380' cellspacing='0' cellpadding='10'>";
echo "<tr><td align='center'>";
echo "Thankyou $name, your mail's been sent<br><br>click <a href=\"$site_addr\">here</a> to return to $site_name";
echo "</td></tr></table>";
}
}
?>
<form name="contact" method="post" action="<? echo $PHP_SELF ?>">
<table align="center" width="380" cellspacing="0" cellpadding="10">
<tr>
<td>name:</td>
<td> </td>
<td><input type="text" name="name" size="40"></td>
</tr>
<tr>
<td>email:</td>
<td> </td>
<td><input type="text" name="email" size="40"></td>
</tr>
<tr>
<td valign="top">message:</td>
<td> </td>
<td><textarea name="message" cols="40" rows="8"></textarea></td>
</tr>
<tr>
<td colspan="3" align="right">
<input type="submit" name="submit" value="send"
style="cursor:pointer">
<input type="reset" name="reset" value="clear"
style="cursor:pointer">
</td>
</tr>
</table>
<p align="center">or send an email to info@sheepondrugs.com</p>
<input type="hidden" name="ip" value="<? echo $_SERVER["REMOTE_ADDR"]; ?>">
</form>[/FONT]