July 14, 200818 yr Hi Everyone, I am making a web contact form for my new website, i have changed hosting companies, my last hoster had customised scripts for just about everything, my new one doesnt so I am having to learn the normal way of doing things using php. Every time I press the submit button I am taken to the error I have specified - "blarg" If anyone could help me i would forever grateful!! PS i got the php side of this form from an online tutorial somewhere... <form method="post" action="mailer.php"> <input type="hidden" name="sub" value="1"> <td valign="top"><table border="0" cellpadding="5" cellspacing="20"> <tr> <td align="left" valign="top"> <label for="Name">Name: </label> <input name="Name" type="text" id="Name" size="40" class="search {required:true}"/> <br /> <label for="Phone">Phone: </label> <input name="Phone" type="text" id="Phone" size="40" class="search {required:true}"/> <br /> <label for="Email">Email: </label> <input name="Email" type="text" id="Email" size="40"class="search {required:true}"/> <br /> <label for="Location">Location: </label> <input name="Email" type="text" id="Email" size="40"class="search {required:true}"/> <br /> <br /> <label for="Comments">Message: </label> <p><br /> <br /> <textarea name="Comments" cols="40" rows="4" id="Comments" class="comments {required:true}"></textarea> </p> <p><br /> <input type="submit" value="submit" columns=50 id="Submit"> </p></td> </tr> </table> </td> </form> --------------------------------------------------------------------------------- PHP FILE --------------------------------------------------------------------------------- <?php if(isset($_POST['submit'])) { $to = "info@aussiewebsites.net"; $subject = "Form Tutorial"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?>
July 14, 200818 yr Hi Everyone, I am making a web contact form for my new website, i have changed hosting companies, my last hoster had customised scripts for just about everything, my new one doesnt so I am having to learn the normal way of doing things using php. Every time I press the submit button I am taken to the error I have specified - "blarg" If anyone could help me i would forever grateful!! PS i got the php side of this form from an online tutorial somewhere... <form method="post" action="mailer.php"> <input type="hidden" name="sub" value="1"> <td valign="top"><table border="0" cellpadding="5" cellspacing="20"> <tr> <td align="left" valign="top"> <label for="Name">Name: </label> <input name="Name" type="text" id="Name" size="40" class="search {required:true}"/> <br /> <label for="Phone">Phone: </label> <input name="Phone" type="text" id="Phone" size="40" class="search {required:true}"/> <br /> <label for="Email">Email: </label> <input name="Email" type="text" id="Email" size="40"class="search {required:true}"/> <br /> <label for="Location">Location: </label> <input name="Email" type="text" id="Email" size="40"class="search {required:true}"/> <br /> <br /> <label for="Comments">Message: </label> <p><br /> <br /> <textarea name="Comments" cols="40" rows="4" id="Comments" class="comments {required:true}"></textarea> </p> <p><br /> <input type="submit" value="submit" columns=50 id="Submit"> </p></td> </tr> </table> </td> </form> --------------------------------------------------------------------------------- PHP FILE --------------------------------------------------------------------------------- <?php if(isset($_POST['submit'])) { $to = "info@aussiewebsites.net"; $subject = "Form Tutorial"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?> Hi the id in the form must match the php $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; name, email etc all lowercase. In your form <input name="Name" type="text" id="Name" The id has a capital Name,these are case sensitive. Pat
July 14, 200818 yr Author Hi, Thanks so much for the reply, I fixed all that stuff up and its STILL not working...i have no idea why, i have been looking at it for ages and i cant see any typos or anything...do you have any more suggestions? Here is the updated version _______________________________________________________________ PHP _______________________________________________________________ <?php if(isset($_POST['submit'])) { $to = "info@aussiewebsites.net"; $subject = "mailform"; $name_field = $_POST['name']; $email_field = $_POST['email']; $location_field = $_POST['location']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message Location: $location_field\n"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "Oh NO!"; } ?> _______________________________________________________________ HTML _______________________________________________________________ <form method="post" action="mailer.php"> <input type="hidden" name="sub" value="1"> <td valign="top"><table border="0" cellpadding="5" cellspacing="20"> <tr> <td align="left" valign="top"> <label for="name">Name: </label> <input name="name" type="text" id="name" size="40" class="search {required:true}"/> <br /> <label for="phone">Phone: </label> <input name="phone" type="text" id="phone" size="40" class="search {required:true}"/> <br /> <label for="email">Email: </label> <input name="email" type="text" id="email" size="40"class="search {required:true}"/> <br /> <label for="location">Location: </label> <input name="location" type="text" id="location" size="40"class="search {required:true}"/> <br /> <br /> <label for="message">Message: </label> <br /> <textarea name="message" cols="40" rows="4" id="message" class="message {required:true}"></textarea> </p> <p><br /> <input type="submit" value="submit" columns=50 id="submit"> </p></td> </tr> </table> </td> </form>
July 14, 200818 yr Hi, Thanks so much for the reply, I fixed all that stuff up and its STILL not working...i have no idea why, i have been looking at it for ages and i cant see any typos or anything...do you have any more suggestions? Here is the updated version _______________________________________________________________ PHP _______________________________________________________________ <?php if(isset($_POST['submit'])) { $to = "info@aussiewebsites.net"; $subject = "mailform"; $name_field = $_POST['name']; $email_field = $_POST['email']; $location_field = $_POST['location']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message Location: $location_field\n"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "Oh NO!"; } ?> _______________________________________________________________ HTML _______________________________________________________________ <form method="post" action="mailer.php"> <input type="hidden" name="sub" value="1"> <td valign="top"><table border="0" cellpadding="5" cellspacing="20"> <tr> <td align="left" valign="top"> <label for="name">Name: </label> <input name="name" type="text" id="name" size="40" class="search {required:true}"/> <br /> <label for="phone">Phone: </label> <input name="phone" type="text" id="phone" size="40" class="search {required:true}"/> <br /> <label for="email">Email: </label> <input name="email" type="text" id="email" size="40"class="search {required:true}"/> <br /> <label for="location">Location: </label> <input name="location" type="text" id="location" size="40"class="search {required:true}"/> <br /> <br /> <label for="message">Message: </label> <br /> <textarea name="message" cols="40" rows="4" id="message" class="message {required:true}"></textarea> </p> <p><br /> <input type="submit" value="submit" columns=50 id="submit"> </p></td> </tr> </table> </td> </form> i had the same problem until i red the server settings for my STMP i add the following on streamline.net hosted sites ini_set("sendmail_from", "info@aussiewebsites.net"); have a look at your server settings for web mail if it doesnt work good luck
Create an account or sign in to comment