aircooled57 Posted March 25, 2008 Share Posted March 25, 2008 i am jst learning php via tutorials and have uploaded this code to a server,its just a really basic form no validation whatsoever, what is wrong with it thats stopping it send emails ,sorry its probably terrible but i only just started learing. <?php /* Details Of Email */ $to="aircooled57@yahoo.co.uk"; $subject="Contact Form Submission"; $clientname=$_POST['name']; $clientemail=$_POST['email']; $message=$_POST['message']; $details= "Email:$clientemail<br> Name:$clientname<br> Message:$message<br>"; mail($to,$subject,$details); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body><form action="postform.php" method="post" enctype="multipart/form-data" name="contactform"> Name:<input type="text" name="name" value="Enter Your Name...." /><br><P> Email:<input type="text" name="email" /><br><p> Comments:<textarea name="comments" cols="" rows="6"></textarea> <input name="submit" type="submit" value="Send Data" /> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
kippi Posted March 25, 2008 Share Posted March 25, 2008 Hey, I have tested this and it seems to work fine. I would try sending the e-mail to a e-mail address that dosn't do a mx lookup up. If you need one to try send it to my e-mail address, msn@skateeast.net and i'll let you know here. Thanks Chris. Quote Link to comment Share on other sites More sharing options...
aircooled57 Posted March 25, 2008 Author Share Posted March 25, 2008 i am quite suprised i have built a fully functioning contact form lol i will try doing what you just said and we will see what happens cheers Quote Link to comment Share on other sites More sharing options...
saiinch Posted March 26, 2008 Share Posted March 26, 2008 i tried this script it worked for me but 99% ________________________________________ HTML Code is used is as follows ____________________________________ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table width="520" border="0"> <tr> <td width="514"><form method="post" action="send.php"> <table width="470" border="0"> <tr> <td width="107">Name:</td> <td width="353"><label> <input type="text" name="name" id="name" /> </label></td> </tr> <tr> <td>Email:</td> <td><label> <input type="text" name="email" id="email" /> </label></td> </tr> <tr> <td valign="top">Inquiring about:</td> <td><label> <select name="inquiry" size="3" multiple="multiple" id="inquiry"> <option value="Web">Web Designing</option> <option value="Graphics">Graphics Designing</option> <option value="Software">Software Development</option> </select> </label></td> </tr> <tr> <td valign="top">Message:</td> <td><label> <textarea name="message" id="message" cols="45" rows="5"></textarea> </label></td> </tr> <tr> <td valign="top"> </td> <td><label> <input type="submit" name="Submit" id="Submit" value="Submit" /> </label></td> </tr> </table> </form> </td> </tr> </table> </body> </html> -------------------------------------------------------------------------------- PHP code is used is as follows ________________________________________________ <?php /* Details Of Email */ $to="saad@creativostudios.net"; $subject="Contact Form Submission"; $clientname=$_POST['name']; $clientemail=$_POST['email']; $message=$_POST['message']; $inquiry=$_POST['inquiry']; $details= "Email:$clientemail<br> Name:$clientname<br> Message:$message<br> Inquiry:$inquiry<br>"; mail($to,$subject,$details); ?> _______________________________________ by 99% i meant that i only get 1 field from multiple selection box whether i select 1 field or i select all the field, i only get 1 field in my email, please mention me how can i get rid of this problem and make my form fully working. Quote Link to comment Share on other sites More sharing options...
aircooled57 Posted March 26, 2008 Author Share Posted March 26, 2008 i dont think that type of box i supposed to send more than one query at a time,i may be wrong, i would suggest using radio buttons perhaps try that? btw im a php noob and that was my first crack at building a contact form using php,anyhowz i hope the code has helped you get your form up and running Quote Link to comment Share on other sites More sharing options...
saiinch Posted March 26, 2008 Share Posted March 26, 2008 yes, thank you friend, with your and a other guy on this forum's help i got my form working thanks to both of you. Quote Link to comment Share on other sites More sharing options...
saiinch Posted March 28, 2008 Share Posted March 28, 2008 my form is working 99% but now i am having only one problem with my form this is the PHP code i am using <?php $name = $_POST['name'] ; $email = $_POST['email'] ; $message = $_POST['message'] ; $phone = $_POST['phone'] ; $inquiry=$_POST['inquiry']; $inquiry=@implode(",",$inquiry); $phone=@implode(",",$phone); $finalmessage='Inquiry For : '.$inquiry.' <br> '.$phone.'<br>'. $message; mail( "me@mynewdomain", "Inquiry from my website.", $finalmessage, "From: $email" ); $respond_subject = "Thank you for contacting us!"; $respond_message = "Hello! Thank you for contacting us! We will get back to you as soon as possible! Yours sincerely, Manager Sales & Marketing Mywebsite name "; mail($email, $respond_subject, $respond_message); header( "Location: http://MyThankYouPage" ); ?> my problem is with the autoresponder, the email which is being send with autoresponder is being delivered like this: this i get in my inbox main page <?php (Nobody Thu, 12:12 pm Thank you for contacting us!) Subject: Thank you for contacting us! From: "Nobody" <nobody@raze.mywebhostcompanyName.com> Date: Thu, March 27, 2008 12:12 pm To: name@domain.com Priority: Normal Options: View Full Header | View Printable Version | Download this as a file ?> i want my name and my email address to be sent from autoresponder not my webhostingcompanyName. Please help me in this also. thanking you all 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.