Jump to content

PHP code and form code problem


Hobo

Recommended Posts

First let me say that I didn't write this php code. I am trying to implement this php file and a "Join our mailing list" form. I can not see what's wrong so I am asking for some help. When I click the submit button on the web page I get:

 

"File Download" ....Do you want to "Open" "Save" "Cancel"

 

For the life of me I can not see why the form code and the .php code are not meshing?

I have attached the .php code and the form code, if someone could take a look at them and tell me (or point me in the right direction) where I made my error(s) , I would appreciate it.

 

Thanks in advance!

 

 

 

PHP code

 

 

<?PHP 

if($_POST['submit']) 

{ 

$recipient="garry@shoalsbendrvpark.com"; 

$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>"; 

} 

?> 

 

 

Below is the Form 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>

 

Any help?

Link to comment
Share on other sites

Two things.  One you are not populating your variables, unless you have register globals turned on.

 

Two, check your server log to see if it's failing because of the missing FROM: header, and also this may need to be a valid email on your domain and not the senders.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.