Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,198,820 members, 7,969,462 topics. Date: Tuesday, 08 October 2024 at 08:17 AM |
Nairaland Forum / Science/Technology / Programming / Php Form To Mail Problem (2362 Views)
Connecting Vb.net 2010 window Form To Sql Server Online / How Do I Connect A Form To Mysql Database / Php Form To Mail (2) (3) (4)
Php Form To Mail Problem by Farriel(m): 12:06pm On Jun 23, 2006 |
Have got this silly problem with a PHP form to mail script. I'm currently working on this site, and on the contact page, have got this form http://www.uciko.com/aboutus/contact.htm The problem is, upon filling the form and hitting the submit button, I do get the mail from the form, but without the entries filled. Was wondering if anyone could look at the code and help; <?php $MailTo = "farriel@gmail.com"; $Body = "My name is $T1 <br> My phone number is $T2 <br> My Fax number is $T3 <br> My email address is $T4 <br> My company Name is $T5 <br> My company phone number is $T6 <br> My company fax number is $T7 <br> My company email address is $T8 <br> This project is classified as $D1 <br> <P> <b>Project Description:</b> $S1 <br> We intend spending about $D2$T9 on this project."; $Subject = "ATTN: New Comment from the web"; $MailFrom = "$T1 <$T2>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: $MailFrom"; if ($MailTo) { if (mail($MailTo, $Subject, $Body, $headers)) {} } $MailTo2 = "farriel@gmail.com"; $Body2 = "$Body"; $Subject2 = "$Subject"; $MailFrom2 = "$T1 <$T2>"; $headers2 = "MIME-Version: 1.0\r\n"; $headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers2 .= "From: $MailFrom2"; if ($MailTo2) { if (mail($MailTo2, $Subject2, $Body2, $headers2)) {} } /* Redirect browser */ $Url = "Location: http://www.uciko.com/aboutus/confirmation.php"; header($Url); /* Make sure that code below does not get executed when we redirect. */ exit(); ?> This is what is between me and a formal completion of the project. |
Re: Php Form To Mail Problem by kazey(m): 12:47pm On Jun 23, 2006 |
hahaa you didnt define the values for the form name strings in the form you are using. Besides where is the form? My name is $T1 My phone number is $T2 My Fax number is $T3 My email address is $T4 My company Name is $T5 My company phone number is $T6 My company fax number is $T7 My company email address is $T8 This project is classified as $D1 Project Description: $S1 We intend spending about on this project. $D2$T9 etc and change this to single ' not "" $MailTo2 = 'farriel@gmail.com'; $Body2 = '$Body'; $Subject2 = '$Subject'; $MailFrom2 = '$T1 <$T2>'; |
Re: Php Form To Mail Problem by sbucareer(f): 1:41pm On Jun 23, 2006 |
Is the page not suppose to be saved as a script file i.e. contact.php rather to contact.htm? You can use this free send a friend code |
Re: Php Form To Mail Problem by kazey(m): 1:46pm On Jun 23, 2006 |
His code seems to be an action page, but without the form you cant really tell where the problem is. I ran the code on my server, works but of course doesnt show the value of the strings. Thats why I asked for the form. |
Re: Php Form To Mail Problem by skima(m): 11:05pm On Jun 23, 2006 |
when u need the value from a variable use double quote. so with his quote i think he's right. The code was developed with register global on. But On the server on which u runs it, register global is off. <?php /* I will advise u follow name conventiona when coding dats dim email's variable has $email and company as $company */ //lets dim our variables $T1=$_POST['T1']; $T2=$_POST['T2']; $T3=$_POST['T3']; $T4=$_POST['T4']; $T5=$_POST['T5']; $T6=$_POST['T6']; $T7=$_POST['T7']; $T8=$_POST['T8']; $T9=$_POST['T9']; $D1=$_POST['D1']; $D2=$_POST['D2']; $S1=$_POST['S1']; $MailTo = "farriel@gmail.com"; $Body = "My name is $T1 <br> My phone number is $T2 <br> My Fax number is $T3 <br> My email address is $T4 <br> My company Name is $T5 <br> My company phone number is $T6 <br> My company fax number is $T7 <br> My company email address is $T8 <br> This project is classified as $D1 <br> <P> <b>Project Description:</b> $S1 <br> We intend spending about $D2$T9 on this project."; $Subject = "ATTN: New Comment from the web"; $MailFrom = "$T1 <$T2>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: $MailFrom"; if ($MailTo) { if (mail($MailTo, $Subject, $Body, $headers)) { } } $MailTo2 = "farriel@gmail.com"; $Body2 = "$Body"; $Subject2 = "$Subject"; $MailFrom2 = "$T1 <$T2>"; $headers2 = "MIME-Version: 1.0\r\n"; $headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers2 .= "From: $MailFrom2 \r\n"; if ($MailTo2) { if (mail($MailTo2, $Subject2, $Body2, $headers2)) {} } /* Redirect browser */ $Url = "Location: http://www.uciko.com/aboutus/confirmation.php"; header($Url); /* Make sure that code below does not get executed when we redirect. */ exit(); ?> |
Re: Php Form To Mail Problem by skima(m): 11:32pm On Jun 23, 2006 |
Enhanced. Make sure u validate for a valid email address. So we will add a validation function to it. <?php
|
Re: Php Form To Mail Problem by kazey(m): 11:37pm On Jun 23, 2006 |
Complications, you dont even know whether his form is get or post, or even if he named his form properly. |
Re: Php Form To Mail Problem by skima(m): 11:49pm On Jun 23, 2006 |
@kazey am still coding please. I have viewed is source page. |
Re: Php Form To Mail Problem by kazey(m): 11:54pm On Jun 23, 2006 |
skima: |
Re: Php Form To Mail Problem by skima(m): 12:02am On Jun 24, 2006 |
@farriel Change ur form to this <form method="post" action=", /contact_form1.php"> |
Re: Php Form To Mail Problem by kazey(m): 12:05am On Jun 24, 2006 |
Nice work, people can be very nice on Nairaland. |
Re: Php Form To Mail Problem by skima(m): 12:27am On Jun 24, 2006 |
We are here to help one another. |
Re: Php Form To Mail Problem by Farriel(m): 7:24pm On Jun 24, 2006 |
Christ! You're my man, Skima! All that code, for free? You're my man! And Kazey, thanks to you to. |
Re: Php Form To Mail Problem by skima(m): 6:45pm On Jun 25, 2006 |
have u tested it? I have not though.
|
Re: Php Form To Mail Problem by Farriel(m): 3:26pm On Jun 27, 2006 |
Yeah, even though I had to tweak some lines of code. The company field wasn't recognizing entries and still prompting users for company name, even though they had done that. I had to delete the print error variables. So right now, no company name is coming through. But all the same man, I really appreciate this. I wish I could your number or something so I could call you when I need to. Perhaps then I just might want to pay you for your time. Thanks Skima. |
Re: Php Form To Mail Problem by skima(m): 3:00pm On Jun 28, 2006 |
change this : $company=$_POST['company']; to : $company=$_POST['company_name']; Dont make any change to your form. my number 08027924441
|
Re: Php Form To Mail Problem by Farriel(m): 6:37pm On Jul 08, 2006 |
Finding this a little lately, all the same thanks. Would call you soon, pal, |
(1) (Reply)
What Level Of Java Is Required For Android Programming ? / 20 Programming Languages You May Have Never Heard Of / Oya Programmers In Nairaland Showcase Your Finest Project With Success Stories
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 65 |