![]() Topic awaiting preservation: Php Code problem (Page 1 of 1) |
|
|---|---|
|
Neurotic (0) Inmate Newly admitted From: |
posted 01-31-2009 21:23
Could someone look at these codes and possibly correct my errors? code: <?PHP
if($_POST['submit'])
{
$recipient="Address removed, TP";
$subject="Contact from Shoals Bend Web Site";
$body="
$name
$email
";
$headers='From: '.$email."\r\n".'Reply-to: '.$email."\r\n";
mail($recipient, $subject, $body, $headers);
echo "
<script>
alert('Your message has been submitted. Thank You!');
window.location='index.html';
</script>";
}
else
{
echo "
<script>
window.location='index.html';
</script>";
}
?>
code: <title>Untitled Document</title>
<style type="text/css">
<!--
form {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
text-decoration: none;
}
button {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
border: 1px solid #FFFFFF;
}
button {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
-->
</style>
</head>
<body>
<form action="sendmail2.php" method="post" name="untitled-3" id="untitled-3">
<table width="63%" border="2" cellpadding="4">
<tr>
<td width="36%"><strong>Join Our Mailing List</strong> </td>
<td width="64%"> </td>
</tr>
<tr>
<td>Name</td>
<td><input name="name" type="text" id="name" /></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text" id="email" /></td>
</tr>
<tr>
<td>Comments</td>
<td><p>
<textarea name="comments" id="comments"></textarea>
</p>
<p> </p></td>
</tr>
<tr>
<td height="34"> </td>
<td><input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Clear" /></td>
</tr>
</table>
</form>
|
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 02-01-2009 12:54
There's a number of things wrong with that script, though I don't immediatly see why you wouldn't receive e-mails. |
|
Obsessive-Compulsive (I) Inmate From: |
posted 02-01-2009 17:01
Tyberius Prime- |
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 02-01-2009 19:13
quote:
|
|
Obsessive-Compulsive (I) Inmate From: |
posted 02-02-2009 21:51
quote:
|
|
Paranoid (IV) Inmate From: cell 3736 |
posted 02-02-2009 22:23
Tyberius Prime, have a cookie! :/ |
|
Neurotic (0) Inmate Newly admitted From: |
posted 02-02-2009 22:52
You wouldn't happen to be on a HostGator hosting account would you? If so they have made it so that email must be authenticated (to help prevent spamming) if sent from a script. I am sure most hosting providers will be following suit sooner or later. |
|
Obsessive-Compulsive (I) Inmate From: |
posted 02-12-2009 19:18
Okay ...I have "repaired" the code and now it works just fine. Thanks Tyberius Prime ( and everyone else) for your input and your help. This is the code that is working with my form. code: <?PHP
if($_POST['submit'])
{
$recipient="me@mysite.com";
$subject="Contact from my Web Site";
$body="
$name
$email
$comments
";
$headers='From: '.$email."\r\n".'Reply-to: '.$email."\r\n";
mail($recipient, $subject, $body, $headers);
echo "
<script>
alert('Your message has been submitted. Thank You!');
window.location='index.html';
</script>";
}
else
{
echo "
<script>
window.location='index.html';
</script>";
}
?>
|