sonyaseth Posted August 20, 2011 Share Posted August 20, 2011 dear friends , i have this html page "</head> <body> <table width="93%" border="0" align="center" cellpadding="2" cellspacing="4"> <tr> <td height="35" colspan="3" valign="top" class="heading" style="padding-top:8px; color:#448B9A; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;"><strong>Contact Us :</strong></td> </tr> <tr> <td width="36%" class="body">Your Name:</td> <td width="64%" colspan="2"> <input type="text" name="textfield3" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Address:</td> <td colspan="2"> <input type="text" name="textfield32" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">City:</td> <td colspan="2"> <input type="text" name="textfield33" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body"> Country:</td> <td colspan="2"> <input type="text" name="textfield34" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Phone no:</td> <td colspan="2"> <input type="text" name="textfield35" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">email Address:</td> <td colspan="2"> <input type="text" name="textfield36" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Comments:</td> <td colspan="2"><textarea name="textarea" rows="5" cols="" style="width:250px;"></textarea></td> </tr> <tr> <td> </td> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28%"> <input type="image" name="imageField2" src="/images/submit.gif" width="62" height="22" /></td> <td width="72%"> <input type="image" name="imageField3" src="/images/reset.gif" width="62" height="22" /></td> </tr> </table></td> </tr> </table> </body> </html> " how i can use this to send email to my email address [email protected] thru site when someone submit the form [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/ Share on other sites More sharing options...
codefossa Posted August 20, 2011 Share Posted August 20, 2011 Please use code tags in the future. [code]<h1>HTML & other code goes in code tags like this.</h1>[ /code] Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1259895 Share on other sites More sharing options...
max_w1 Posted August 20, 2011 Share Posted August 20, 2011 I suggest you to use an external email library to send your form to email, you can do the php scripting manually but that will take you long time. You can use PEAR class or http://www.geekology.co.za/blog/2009/11/simpler-way-to-send-text-html-emails-with-attachments-in-php/ a stand alone class of code ignighter will also do the work for you. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1259898 Share on other sites More sharing options...
sonyaseth Posted August 21, 2011 Author Share Posted August 21, 2011 thnks for yr reply, but the problem is that is a email form inside a webpage where when some fill his details and hit submit i recv a email in my account which is configure in script for this i have to put php configuration file in post or action of my page code "http://www.solucioneshttp.com.ar/Portfolio/regalos_joyas/YT-JW0103/html/contact.html" this is a example page of this email form i think have to mange a change in " <td><form id="form1" name="form1" method="post" action=""> and then put a in relation with php file Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260036 Share on other sites More sharing options...
max_w1 Posted August 21, 2011 Share Posted August 21, 2011 First of all, change the names of those text fields, try to give them names as per their lable. for ex.. Your Name would be <input type="text" style="width:250px; height:13px;" name="name"> insteand of <input type="text" style="width:250px; height:13px;" name="textfield3"> when you are done, make your from look like this <form action="mail.php" method="post" enctype="multipart/form-data" name="form1" target="" id="from1"> crate a new php file on your server and name it mail.php and paste the below code there: <?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test?"sent":"error"; ?> now download the mailer.class.php from the attachment and place it next to mail.php on your server. you should now be able to send the mail. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260051 Share on other sites More sharing options...
sonyaseth Posted August 21, 2011 Author Share Posted August 21, 2011 thnks i think it will resovle the issue once again thnks to phpfreak team and to u also Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260060 Share on other sites More sharing options...
darkfreaks Posted August 21, 2011 Share Posted August 21, 2011 dont forget to mark as solved Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260063 Share on other sites More sharing options...
sonyaseth Posted August 21, 2011 Author Share Posted August 21, 2011 i have used this and it works fine but not fully " Only two thing are to be resolved to make it correct or better " 1- In gmail box i recv only a email showing "encruption format 3g ready xx344axOO3cc " and nothing else "that was filled by the user in form" 2-Other is that after hitting the submit button or after sending email it shows text '"sent " and redirect to mail.php ---- instead of it it will be more sweet if it redirect to home page or index.htm while a confirmation of sent or thnking u in pop popup or in box Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260071 Share on other sites More sharing options...
max_w1 Posted August 21, 2011 Share Posted August 21, 2011 Sorry i forgot to create a variable, just add this line of code bellow $comments. $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; Hope that will help. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260073 Share on other sites More sharing options...
max_w1 Posted August 21, 2011 Share Posted August 21, 2011 If you want redirect, use this code: <html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "../javascriptredirect.php" } //--> </script> <?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test? ?> </head> <body onLoad="setTimeout('delayer()', 5000)"> <h2>Your Mail has been sent !</h2> <p>You are being redirected in a few movements, please wait..... </p> </body> </html><?php :"error"; ?> i have not tested the redirect code, let me know if there is a problem. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260074 Share on other sites More sharing options...
sonyaseth Posted August 21, 2011 Author Share Posted August 21, 2011 Thnks First issure is solved almost i recvd whatever user has filled in email form on site now reidrect issue you have mention "window.location = "../javascriptredirect.php" where is the javascriptredirect.php file do i have to change what modification to redirect to index.htm file or home page thnks for earlier reply if this problem also solved then i can upload it on site and work futher on it may b http://blogulate.com/content/php-function-for-javascript-redirect/ will give u better clue to redirect Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260083 Share on other sites More sharing options...
darkfreaks Posted August 21, 2011 Share Posted August 21, 2011 change javascriptredirect.php to the url you want it to redirect to Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260161 Share on other sites More sharing options...
sonyaseth Posted August 21, 2011 Author Share Posted August 21, 2011 thnks to all seniors i will fix this and work around on 2nd part which is userlogin managment with 2 levels (new and Old) and login pages and come with my query again thnks once again Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1260182 Share on other sites More sharing options...
sonyaseth Posted August 27, 2011 Author Share Posted August 27, 2011 while redirection in form mail thru this " <html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "/index.htm" } //--> </script> <?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test? ?> </head> <body onLoad="setTimeout('delayer()', 5000)"> <h2>Your Mail has been sent !</h2> <p>You are being redirected in a few movements, please wait..... </p> </body> </html><?php :"error"; ?> i m having this error Parse error: syntax error, unexpected ';' in/public_html/mail.php on line 26 bu with oringal code without redirectin is working fine "<?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test?"sent":"error"; ?> how to redirect Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262559 Share on other sites More sharing options...
sonyaseth Posted August 27, 2011 Author Share Posted August 27, 2011 pls solve this issue Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262654 Share on other sites More sharing options...
darkfreaks Posted August 27, 2011 Share Posted August 27, 2011 you can solve it yourself by pressing "Mark Topic As Solved" in the left lower hand corner i believe. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262660 Share on other sites More sharing options...
sonyaseth Posted August 27, 2011 Author Share Posted August 27, 2011 i will write the topic as solved after this issue is solved i earlier write it as solved thnk ing that it will work for sure but when i test it on website it show the error Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262663 Share on other sites More sharing options...
darkfreaks Posted August 27, 2011 Share Posted August 27, 2011 please give the current code and the error so we can tell you what ths issue is. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262666 Share on other sites More sharing options...
sonyaseth Posted August 27, 2011 Author Share Posted August 27, 2011 code "<html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "/index.htm" } //--> </script> <?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test? ?> </head> <body onLoad="setTimeout('delayer()', 5000)"> <h2>Your Mail has been sent !</h2> <p>You are being redirected in a few movements, please wait..... </p> </body> </html><?php :"error"; ?>" ERROR "Parse error: syntax error, unexpected ';' in /mail.php on line 26 But oringal code for which i am thnkful :hail_freaks:withour redirection working fine which is also given blow "<?php ///make sure you name your input fields in your html page same as the names inside $_POST[''] below. $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $country = $_POST['country']; $phone_number = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $msge = "Senders Name : ".$name."<br> Senders Address : ". $address."<br> Senders City : " .$city."<br> Senders Country : ".$country."<br> Senders Phone Number : ".$phone_number."<br> Senders Email : ".$email."<br> Senders Comments : ".$comments; include("data/mailer.class.php"); $mailer=new mailer("[email protected]","New Job Application",$msge,"From: webmaster@localhost"); //$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test?"sent":"error"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262668 Share on other sites More sharing options...
Pikachu2000 Posted August 27, 2011 Share Posted August 27, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262669 Share on other sites More sharing options...
darkfreaks Posted August 27, 2011 Share Posted August 27, 2011 Like Pikachu Mentioned can you place your code inside bbcode tags so we can make mroe sense of your code. Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262678 Share on other sites More sharing options...
darkfreaks Posted August 28, 2011 Share Posted August 28, 2011 also echo $test?? Should be: echo $test; Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262762 Share on other sites More sharing options...
sonyaseth Posted August 28, 2011 Author Share Posted August 28, 2011 where is the error i m still unable to sort out to me the error is some whre in this sectionmetnioned below /$mailer->file("".$file1); $mailer->attach("text/plain","see.txt","encruption format 3g ready xx344axOO3cc"); $test=$mailer->send(); echo $test? ?> </head> <body onLoad="setTimeout('delayer()', 5000)"> <h2>Your Mail has been sent !</h2> <p>You are being redirected in a few movements, please wait..... </p> Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262838 Share on other sites More sharing options...
darkfreaks Posted August 28, 2011 Share Posted August 28, 2011 read the above post should solve error Quote Link to comment https://forums.phpfreaks.com/topic/245303-email-form/#findComment-1262839 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.