jaic Posted June 11, 2007 Share Posted June 11, 2007 Hi all Ive just done this site, and im having problems with this form... could someone take a look please... ive scoured it over and over, but to no avail.. thanks www.oceansafe.co.uk/contact.php Jai Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/ Share on other sites More sharing options...
chocopi Posted June 11, 2007 Share Posted June 11, 2007 what are the actual problems ? Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272302 Share on other sites More sharing options...
jaic Posted June 11, 2007 Author Share Posted June 11, 2007 its seems that i keep getting the "Notice: Undefined Variable in line "265" etc ... but i have used this form time and time again on different domains without any problems Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272305 Share on other sites More sharing options...
chocopi Posted June 11, 2007 Share Posted June 11, 2007 can you post the code then Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272307 Share on other sites More sharing options...
jaic Posted June 11, 2007 Author Share Posted June 11, 2007 <?php if(isset($_POST['Submit'])) { $name = $_POST['name']; $tele = $_POST['tele']; $email = $_POST['email']; $comments = $_POST['comments']; $mailing = $_POST['mailing']; if($name == '' or $email == '' or $comments == '') { $err = true; $msg = 'Please complete all the required fields for us to be able to contact you.'; } else { $mailmsg = 'OceanSafe WEBSITE MAIL:' . "\n\n"; $mailmsg.= 'Name: ' . $name . "\n"; $mailmsg.= 'Tele: ' . $tele . "\n"; $mailmsg.= 'Email: ' . $email . "\n"; $mailmsg.= 'Required: ' . $required . "\n"; if($mailing == 'true') { $mailmsg.= 'Please add me to your mailing list to receive notice of offers from time to time'; } if (eregi("\r",$email) || eregi("\n",$email)){ die ("spam!"); } else { if(mail(email@domainname.co.uk,'OceanSafe - Web Enquiry Form', $mailmsg, "From: noreply@domainname.co.uk")) { header("Location: validate.htm"); } } } } ?> and in th form <form id="form2" method="post" action="contact.php"> <div> <p align="center"> <font size="2" face="Verdana"> <label for="name">Full Name:*</label><br> <input name="name" type="text" class="text" id="name" value="<?php echo $name; ?>" size="45" /><br> <label for="name">Daytime Contact Number:*</label><br> <input name="tele" type="text" class="text" id="tele" value="<?php echo $tele; ?>" size="45" /><br> <label for="email">Your Email Address:*</label><br> <input name="email" type="text" class="text" id="email" value="<?php echo $email; ?>" size="45" /><br> <label for="comments">Work Required :*</label><br> <textarea name="comments" cols="34" rows="2" class="text" id="comments"><?php echo $comments; ?></textarea><br> <label for="mailing">Add me to your mailing list</label> <input type="checkbox" name="mailing" value="true" id="mailing" /><br> <input name="Submit" type="submit" class="btn" value="SEND" /> </font> </div> </form> Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272309 Share on other sites More sharing options...
chocopi Posted June 11, 2007 Share Posted June 11, 2007 which one is line is 265 ? Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272314 Share on other sites More sharing options...
jaic Posted June 11, 2007 Author Share Posted June 11, 2007 there is an NOTICE on every line that contains a VALUE in the FORM section, such as: value="<?php echo $name; ?>" and so on and so forth ... Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272326 Share on other sites More sharing options...
Psycho Posted June 11, 2007 Share Posted June 11, 2007 I *think* you have error handling on either in your script or turned on for the server by default. Since the page has not been POSTed, the variables do not have a value and it is throwing the error. Try ensuring that the variables have been set first: <?php <?php $name=''; $tele=''; $email=''; $comments=''; $mailing=''; if(isset($_POST['Submit'])) { $name = $_POST['name']; $tele = $_POST['tele']; $email = $_POST['email']; $comments = $_POST['comments']; $mailing = $_POST['mailing']; if($name == '' or $email == '' or $comments == '') { $err = true; $msg = 'Please complete all the required fields for us to be able to contact you.'; } else { $mailmsg = 'OceanSafe WEBSITE MAIL:' . "\n\n"; $mailmsg.= 'Name: ' . $name . "\n"; $mailmsg.= 'Tele: ' . $tele . "\n"; $mailmsg.= 'Email: ' . $email . "\n"; $mailmsg.= 'Required: ' . $required . "\n"; if($mailing == 'true') { $mailmsg.= 'Please add me to your mailing list to receive notice of offers from time to time'; } if (eregi("\r",$email) || eregi("\n",$email)){ die ("spam!"); } else { if(mail(email@domainname.co.uk,'OceanSafe - Web Enquiry Form', $mailmsg, "From: noreply@domainname.co.uk")) { header("Location: validate.htm"); } } } } ?> ?> Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272331 Share on other sites More sharing options...
trq Posted June 11, 2007 Share Posted June 11, 2007 You need to replace... <?php echo $email; ?> with... <?php echo isset($email) ? $email : ''; ?> for each field. Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272335 Share on other sites More sharing options...
jaic Posted June 11, 2007 Author Share Posted June 11, 2007 Thank you both for your help, i am going away to experiment, and ill let you know of the outcome many thanks Jai Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272343 Share on other sites More sharing options...
jaic Posted June 11, 2007 Author Share Posted June 11, 2007 Thanks, with both suggestions actioned it now works perfectly thanks for your help!!!! Jai Quote Link to comment https://forums.phpfreaks.com/topic/55090-solved-not-seen-this-before/#findComment-272348 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.