November 23, 200817 yr Hey guyz, am kinda new around here....am a web designer and also a web programmer, i currently code in php...i've been having problems with the mail function ever since i started coding.....i've also tried uploading my script to test online but it still does'nt work....below is the said script....i wanna plead with u guyz to at least take time out to review my script and help me check to see if there are any mistakes.. <?php $form = " <form action=\"test.php\" method=\"post\"> <input type=\"hidden\" name=\"seenform\" value=\"y\"> <b>Send us your comments!</b><br> Your Name:<br> <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"20\" value=\"\"><br> Your Email:<br> <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"40\" value=\"\"><br> Your Comments:<br> <textarea name=\"comments\" rows=\"3\" cols=\"30\"></textarea><br> <input type=\"submit\" value=\"submit!\"> </form> "; // If we haven't already seen the form ($seenform passed by hidden // form value), show the form. if ($seenform != "y") : print "$form"; else : $to = "lawillas4ever@yahoo.com"; $subject = "$name has sent you a comment"; $headers = "From: $email"; $message = "Good day Admin A visitor to your website has just filled in a comment. Find details below: Name: $name Email: $email Comments: $comments"; $eno = "mail($to,$subject,$message,$headers)"; if( $eno): print "Thank you $name for taking a moment to send us your comments!"; endif; endif; ?>
November 23, 200817 yr As a matter of fact, I was thinking about putting a contact form on my portfolio site that I am working on. I haven't put it online, but i will post eventually or when i think that it is smoking hot. Back on subject, I am looking over your code and I don't like the way you did that. I think you should just keep the form just a regular form. Because you don't want to jumble it with php if you don't have to, it just makes another thing to worry about or troubleshoot. I am not sure how much you know about php, but I will recommend two sites that I think will help you out a little or at least point you in the right direction. http://www.tizag.com/phpT/forms.php Basics on form with php http://www.tutorialtastic.co.uk/tutorial/p...e_and_protected - free php mail handler. I havnt tested this site yet, but ifyou have any problems let me know. Again, I hope this helps. Let me know how it turns out or if you need help any further. -John
January 18, 200917 yr Hey guyz, am kinda new around here....am a web designer and also a web programmer, i currently code in php...i've been having problems with the mail function ever since i started coding.....i've also tried uploading my script to test online but it still does'nt work....below is the said script....i wanna plead with u guyz to at least take time out to review my script and help me check to see if there are any mistakes.. <?php $form = " <form action=\"test.php\" method=\"post\"> <input type=\"hidden\" name=\"seenform\" value=\"y\"> <b>Send us your comments!</b><br> Your Name:<br> <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"20\" value=\"\"><br> Your Email:<br> <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"40\" value=\"\"><br> Your Comments:<br> <textarea name=\"comments\" rows=\"3\" cols=\"30\"></textarea><br> <input type=\"submit\" value=\"submit!\"> </form> "; // If we haven't already seen the form ($seenform passed by hidden // form value), show the form. if ($seenform != "y") : print "$form"; else : $to = "lawillas4ever@yahoo.com"; $subject = "$name has sent you a comment"; $headers = "From: $email"; $message = "Good day Admin A visitor to your website has just filled in a comment. Find details below: Name: $name Email: $email Comments: $comments"; $eno = "mail($to,$subject,$message,$headers)"; if( $eno): print "Thank you $name for taking a moment to send us your comments!"; endif; endif; ?> Your code is using strings that have not been declared anywhere and assuming your server is running a default version of PHP5 you cant get away with lazy strings anymore: if ($seenform != "y") should be: if ($_POST["seenform"] != "y") and so on.
Create an account or sign in to comment