473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Having problems submitting form details to email

Hi,

I'm new to PHP and seem to be having soom problems, I'm getting confused with all the different styles of script writing.
I've created a PHP script to submit details to my email but the details don't forward. PHP is enabled on the windows server host site.

I don't get any errors it just stays on the submit form.

below is the scripts for the submit form and the sendmail form.
Also how do you get validation to work with the scripts?

Thanks.

Matt

<title>Car Sales</title>

</HEAD>
<body marginheight="0" topmargin="0" link="0000ff" vlink="0000ff" alink="0000ff">

<form method="POST" action=sendmail.php>

<input type="hidden" name="recipient" value="sales@v2automotivesolutions.co.uk">
<input type="hidden" name="success_page" value="www.v2automotivesolutions.co.uk/success.html">


<input type="hidden" name="required" value="Name,Email_address,Car_Make,Model,Mileage,R egistration">
<input type="hidden" name="sort" value="Name,telephone_number,Email_address,Mobile_ Number,Car_Make,Model,Mileage,Registration,Transmi ssion,Condition,Exterior_Colour,Servcie_History">

<BR><BR>
<table bgcolor=#999999 align=center width=500><tr><td>

<small><font face="Verdana" color="#ffff00"><b>Please fill in your information <br> <BR></b> </font></font></small>

</td></tr><table bgcolor=#999999 align=center width=500><tr><td>

<table>
<tr><td><p align="right"><font color="#000000" face="Verdana">Name: </font></td>
<td bgcolor="#999999"><input type="text" size="21" name="Name" maxlength="55"><font color=red>*</td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Telephone Number: </font></td>
<td><input type="text" size="21" name="Telephone_number" maxlength="55"></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Mobile Number: </font></td>
<td bgcolor="#999999"><input type="text" size="21" name="Mobile_Number" maxlength="25"><font color="#ff0000" face="Verdana" size="1"></font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Email Address: </font></td>
<td><input type="text" size="21" name="Email_address" maxlength="25"><font color="#ff0000" face="Verdana" size="1"><font color=red>*</font></td>
</tr>


<tr><td><p align="right"><font color="#000000" face="Verdana">Car Make: </font></td>
<td><input type="text" size="21" name="Car_Make" maxlength="25"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. Ford)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Model: </font> </td>
<td><input type="text" name="Model" size="21"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. Mondeo)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Specification: </font> </td>
<td><input type="text" name="Specification" size="21"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. LX / Ghia)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Registration: </font> </td>
<td><input type="text" name="Registration" size="21"><font color="#ffffff" face="Verdana" size="1"></font><font color=red>*</td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Mileage: </font> </td>
<td><input type="text" name="Mileage" size="21"><font color="#ffffff" face="Verdana" size="1"><font color=red>*</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Exterior Colour: </font> </td>
<td><input type="text" name="Exterior_Colour" size="21"><font color="#ffffff" face="Verdana" size="1"></font></td>
</tr>

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Transmission:</font></td>
<td BGCOLOR="#999999" NAME="Transmission">
</SELECT><br>
<select name="attn" size="1">
<option value=" Manual ">Manual </option>
<option value=" Automatic ">Automatic </option>
<option value=" Automatic ">Semi Automatic </option>
</select>
<br /><br />

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Service History:</font></td>
<td BGCOLOR="#999999" NAME="Service History">
</SELECT>
<select name="attn" size="1">
<option value=" None ">None </option>
<option value=" Part ">Part </option>
<option value=" Full ">Full </option>
</select>
<br />

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Condition:</font></td>
<td BGCOLOR="#999999" NAME="Condition">
</SELECT><br>
<select name="attn" size="1">
<option value=" Excellent ">Excellent </option>
<option value=" Good ">Good </option>
<option value=" Average ">Average </option>
<option value=" Poor ">Poor </option>
<option value=" Damaged ">Damaged </option>
</select>
<br /><br />

<tr><td><p align="right"><font color="#000000" face="Verdana">Additional Comments: </font> </td>
<tr><td><p align="right"><textarea name="notes" rows="6" cols="25"></textarea>
</tr>

<tr></td></form>
</td></table>

<br /><br /><br /><br />

<tr><td><p align="center"><font color="#000000" face="Verdana"> <font color=red>*</font> indicates a field is required</small></td></tr>

<tr><td><p align="center"<p><input type="submit" value=" &nbsp; &nbsp; &nbsp; &nbsp; Send &nbsp; &nbsp; &nbsp; &nbsp; "> </p>


</center><br><br>
</center></div>
<br>



---------------------------------------------------------------------------------------------------------
sendmail script


<?
$to = "sales@v2automotivesolutions.co.uk";
$from_header = "From: $from";
if($contents != "")
{
//send mail - $subject & $sales@v2automotivesolutions.co.uk
mail(" v2automotivesolutions.co.uk ") ; $to, $Name, $Telephone_number, $Email, $Mobile_Number, $Car_Make, $Model, $Mileage, $Registration, $Transmission,
$Condition, $External_Colour, $Service_history, from_header);
// redirect back to url visitor came from
header( "Location: http://www.mvalarms.co.uk/success.html" );
}
else
{
print("<HTML><BODY>Error, no comments were submitted!");
print("</BODY></HTML>");
}?>
?>
Jan 12 '07 #1
3 1643
ronverdonk
4,258 Expert 4TB
You do not really expect our members to read this unformatted bunch of code?
Please read the Posting Guidelines before you post in this forum!

Before you can fill and send your email form you must fill the php variables that you use to populate that email message. So where in sendmail.php do you read the passed variables in the $_POST array and assign them to the php variables?
Another thing: the message body you want to send must be stored in one variable. You cannot send all those different variables separately.

Ronald :cool:
Jan 12 '07 #2
The code below is to give you an idea of what to do.


<?
$name = $_POST['Name']; //The Name sent from your form
$email = $_POST['Email_address']; //The Email_address sent from your form
$notes = $_POST['notes'];
exit;
$mymail = "sales@v2automotivesolutions.co.uk";
$from = "From: $email";

//send mail - $subject & $sales@v2automotivesolutions.co.uk
$todayis = date("F j, Y");
$subject = "Inquiry";
$message = "$todayis \n
Name : $market_type \n
Email : $email \n
$notes
";

$from = "From: $from\r\n";

mail($myemail, $subject, $message, $from); Sends the email

// redirect back to url visitor came from
header( "Location: http://www.mvalarms.co.uk/success.html" );
?>
Jan 12 '07 #3
halles
7
Hi,

I'm new to PHP and seem to be having soom problems, I'm getting confused with all the different styles of script writing.
I've created a PHP script to submit details to my email but the details don't forward. PHP is enabled on the windows server host site.

I don't get any errors it just stays on the submit form.

below is the scripts for the submit form and the sendmail form.
Also how do you get validation to work with the scripts?

Thanks.

Matt

<title>Car Sales</title>

</HEAD>
<body marginheight="0" topmargin="0" link="0000ff" vlink="0000ff" alink="0000ff">

<form method="POST" action=sendmail.php>

<input type="hidden" name="recipient" value="sales@v2automotivesolutions.co.uk">
<input type="hidden" name="success_page" value="www.v2automotivesolutions.co.uk/success.html">


<input type="hidden" name="required" value="Name,Email_address,Car_Make,Model,Mileage,R egistration">
<input type="hidden" name="sort" value="Name,telephone_number,Email_address,Mobile_ Number,Car_Make,Model,Mileage,Registration,Transmi ssion,Condition,Exterior_Colour,Servcie_History">

<BR><BR>
<table bgcolor=#999999 align=center width=500><tr><td>

<small><font face="Verdana" color="#ffff00"><b>Please fill in your information <br> <BR></b> </font></font></small>

</td></tr><table bgcolor=#999999 align=center width=500><tr><td>

<table>
<tr><td><p align="right"><font color="#000000" face="Verdana">Name: </font></td>
<td bgcolor="#999999"><input type="text" size="21" name="Name" maxlength="55"><font color=red>*</td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Telephone Number: </font></td>
<td><input type="text" size="21" name="Telephone_number" maxlength="55"></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Mobile Number: </font></td>
<td bgcolor="#999999"><input type="text" size="21" name="Mobile_Number" maxlength="25"><font color="#ff0000" face="Verdana" size="1"></font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Email Address: </font></td>
<td><input type="text" size="21" name="Email_address" maxlength="25"><font color="#ff0000" face="Verdana" size="1"><font color=red>*</font></td>
</tr>


<tr><td><p align="right"><font color="#000000" face="Verdana">Car Make: </font></td>
<td><input type="text" size="21" name="Car_Make" maxlength="25"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. Ford)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Model: </font> </td>
<td><input type="text" name="Model" size="21"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. Mondeo)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Specification: </font> </td>
<td><input type="text" name="Specification" size="21"><font color=red>*<font color="#ffffff" face="Verdana" size="1">(i.e. LX / Ghia)</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Registration: </font> </td>
<td><input type="text" name="Registration" size="21"><font color="#ffffff" face="Verdana" size="1"></font><font color=red>*</td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Mileage: </font> </td>
<td><input type="text" name="Mileage" size="21"><font color="#ffffff" face="Verdana" size="1"><font color=red>*</font></td>
</tr>

<tr><td><p align="right"><font color="#000000" face="Verdana">Exterior Colour: </font> </td>
<td><input type="text" name="Exterior_Colour" size="21"><font color="#ffffff" face="Verdana" size="1"></font></td>
</tr>

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Transmission:</font></td>
<td BGCOLOR="#999999" NAME="Transmission">
</SELECT><br>
<select name="attn" size="1">
<option value=" Manual ">Manual </option>
<option value=" Automatic ">Automatic </option>
<option value=" Automatic ">Semi Automatic </option>
</select>
<br /><br />

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Service History:</font></td>
<td BGCOLOR="#999999" NAME="Service History">
</SELECT>
<select name="attn" size="1">
<option value=" None ">None </option>
<option value=" Part ">Part </option>
<option value=" Full ">Full </option>
</select>
<br />

<tr><td BGCOLOR="#999999"><p align="right"><font color="#000000" face="Verdana"> Condition:</font></td>
<td BGCOLOR="#999999" NAME="Condition">
</SELECT><br>
<select name="attn" size="1">
<option value=" Excellent ">Excellent </option>
<option value=" Good ">Good </option>
<option value=" Average ">Average </option>
<option value=" Poor ">Poor </option>
<option value=" Damaged ">Damaged </option>
</select>
<br /><br />

<tr><td><p align="right"><font color="#000000" face="Verdana">Additional Comments: </font> </td>
<tr><td><p align="right"><textarea name="notes" rows="6" cols="25"></textarea>
</tr>

<tr></td></form>
</td></table>

<br /><br /><br /><br />

<tr><td><p align="center"><font color="#000000" face="Verdana"> <font color=red>*</font> indicates a field is required</small></td></tr>

<tr><td><p align="center"<p><input type="submit" value=" &nbsp; &nbsp; &nbsp; &nbsp; Send &nbsp; &nbsp; &nbsp; &nbsp; "> </p>


</center><br><br>
</center></div>
<br>



---------------------------------------------------------------------------------------------------------
sendmail script


<?
$to = "sales@v2automotivesolutions.co.uk";
$from_header = "From: $from";
if($contents != "")
{
//send mail - $subject & $sales@v2automotivesolutions.co.uk
mail(" v2automotivesolutions.co.uk ") ; $to, $Name, $Telephone_number, $Email, $Mobile_Number, $Car_Make, $Model, $Mileage, $Registration, $Transmission,
$Condition, $External_Colour, $Service_history, from_header);
// redirect back to url visitor came from
header( "Location: http://www.mvalarms.co.uk/success.html" );
}
else
{
print("<HTML><BODY>Error, no comments were submitted!");
print("</BODY></HTML>");
}?>
?>
Hi!
When using "mail() it's not allow more then 3-4 parameter,
for information , put your data in "$message" value and use html header.

you wil find usefull info at : http://uk2.php.net/manual

http://www.halleswebdesign.com
Jan 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
2
by: belzibob | last post by:
I have inherited a table where each row is a <form> Each of these rows has only four columns, those being: 1) Item number 4) Quantity (blank textbox to fill in) 3) Description 4) Add link (to...
1
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
1
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
5
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
7
meenakshia
by: meenakshia | last post by:
hi forum i have been trying to use a way to validate my form but i was unable to use it properly pls rectify my mistakes. i m using input type as a button and calling a function to save the form...
3
by: jerry101 | last post by:
Okay, so I have no knowledge with ASP and I was asked to look at this contact form because the emails aren't delivering. I'll post the whole page of code, because I am unsure at what is what...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.