Jump to content

PHP contact form sending mail problem


vinpkl

Recommended Posts

hi everyone

 

just joined,

 

i using php script to send email. i m receiving the labels only not the content filled in the form. means i m receiving the heading "name = " but not receiving "my name written" when i fill the name in the input field for the name in the form.

 

just this i m receiving

Full Name : 

Email ID : 

Mobile : 

enquiry :

 

vineet

 

 

this is my php script used to send mail

<?php 

 

$Visitor_Name1;      //Name Of Visitor. 

$Visitor_Email1;      //Visitors Email address.

$Visitor_Mobile1;    //mobile Of Visitor. 

$Visitor_Enquiry1;  //information

 

//Assignment of form values in variables. 

 

$Visitor_Name1=$name1; 

$Visitor_Email1=$email1;   

$Visitor_Mobile1=$mobile1;

$Visitor_Enquiry1=$enquiry1;

 

$message .= "Full Name :  $Visitor_Name1\n"; 

$message .= "Email ID :  $email1\n";

$message .= "Mobile :  $mobile1\n";   

$message .= "enquiry : $Visitor_Enquiry1";

$from ="info@user.com"; 

$to = "me@yahoo.com";

$subject = "GADGETS ENQUIRY FORM"; 

$headers = "From: $from"; 

 

mail($to,$subject,$message,$headers); 

$URL="thanks.html";

header ("Location: $URL");

 

?>   

-------------------------

this is my html form

<form action="enquiry.php" class="content"  name="form1" method="post"><table width="350" border="0" cellspacing="0" cellpadding="8">

                  <tr>

                    <td colspan="2">You can also fill our enquiry form :</td>

                    </tr>

                  <tr>

                    <td width="147">Name : </td>

                    <td width="353"><input name="name1" type="text" id="name1" tyle="width:250px" /></td>

                  </tr>

                  <tr>

                    <td>Email : </td>

                    <td><input name="email1" type="text" id="email1" style="width:250px" /></td>

                  </tr>

                  <tr>

                    <td>Mobile : </td>

                    <td><input name="mobile" type="text" id="mobile" style="width:250px" /></td>

                  </tr>

                  <tr>

                    <td valign="top">Enquiry : </td>

                    <td><textarea name="enquiry" rows="4" id="enquiry" tyle="width:250px"></textarea></td>

                  </tr>

                  <tr>

                    <td> </td>

                    <td><input type="submit" name="Submit" value="Submit" class="submt" /></td>

                  </tr>

                </table></form>

 

Link to comment
Share on other sites

i think you need this

$Visitor_Name1=$_POST['name1'];   
$Visitor_Email1=$_POST['email1'];     
$Visitor_Mobile1=$_POST['mobile1'];
$Visitor_Enquiry1=$_POST['enquiry1']; 

 

Scott.

 

hi scott

 

thanks. you were right. i got it working with your code.

 

one thing more i would like to ask that how can the visitor to the site who fills email address in the form receive a confirmation email in his email address that we have received his information on submitting form.

 

i mean when the visitor submits the form he should receive an confirmation email in his email adress.

 

vineet

 

 

Link to comment
Share on other sites

can you just add this to the bottom

$message = "confirmation Email this info has been sent to {$to}\n{$message}";
mail($Visitor_Email1,"confirmation Email",$to,$message);

 

Scott.

 

hi scott

 

your this code also worked fine. but there is one issue. and that is the "From" body contains "Nobody". i mean where we read that this email is from this person. there its written "Nobody".

 

I want to replace "Nobody" with clients "email address". When the visitor receives the confirmation email in his email account he should read that this email is from that website where he filled the form.

 

vineet

Link to comment
Share on other sites

just add some headers to it

$headers = "From: $from";
mail($Visitor_Email1,"confirmation Email",$to,$message,$headers);

 

Scott.

 

hi scott

 

i used this in two ways

--------------------------------

$message = "confirmation Email this info has been sent to {$to}\n{$message}";

$headers = "From: $from";

mail($Visitor_Email1,"confirmation Email",$to,$message);

 

------------------------------------

$message = "confirmation Email this info has been sent to {$to}\n{$message}";

mail($Visitor_Email1,"confirmation Email",$to,$message);

$headers = "From: $from";

mail($Visitor_Email1,"confirmation Email",$to,$message);

-----------------------

 

in first way i receive mail with the same from body contains "nobody" and by using second way i dont receive any email.

 

vineet

Link to comment
Share on other sites

you need to add

,$headers);

to the end of your mail() call

 

Scott.

 

hi scott i tried

--------------------------------------------

$headers = "From: $from";

$message = "confirmation Email this info has been sent to {$to}\n{$message}";

mail($Visitor_Email1,"confirmation Email",$to,$message,$headers);

-------------------------------------------------

 

$message = "confirmation Email this info has been sent to {$to}\n{$message}";

mail($Visitor_Email1,"confirmation Email",$to,$message,$headers);

 

------------------------------------------------------------

 

the from body contains the same "nobody"

 

vineet

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.