Hobo Posted January 31, 2009 Share Posted January 31, 2009 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? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 31, 2009 Share Posted January 31, 2009 Are you running the file without a host just in your browser? Quote Link to comment Share on other sites More sharing options...
Hobo Posted January 31, 2009 Author Share Posted January 31, 2009 Yes I was :-\ Now I have it on-line and it seems as though it works, but...I do not get the emails. Here is a link. http://www.shoalsbendrvpark.com/Untitled-3.html Thanks for looking. Quote Link to comment Share on other sites More sharing options...
revraz Posted January 31, 2009 Share Posted January 31, 2009 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. Quote Link to comment Share on other sites More sharing options...
Hobo Posted January 31, 2009 Author Share Posted January 31, 2009 Thanks revraz.... Server log checked and all seems okay and successful.... I do not know what "populating your variables" is? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 31, 2009 Share Posted January 31, 2009 Like $var = $_POST['fieldname']; Quote Link to comment Share on other sites More sharing options...
Hobo Posted January 31, 2009 Author Share Posted January 31, 2009 I'm lost...back to studies. Thanks for the replys folks. I will keep trying! Quote Link to comment Share on other sites More sharing options...
revraz Posted January 31, 2009 Share Posted January 31, 2009 When you use a FORM, you need to grab those variables that you are setting in the FORM. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.