Forums
This topic is locked
Need Help With Email Form
Posted 02 Aug 2006 00:58:16
1
has voted
02 Aug 2006 00:58:16 Mark Matthews posted:
I'm tring to get the information from my form (text fields, drop down lists, radio buttons) to be sent to my email. I've done searches to try and figure this out with no luck. Can anyone help. I've posted my form code and php code below. Thanks for any Help.HTML form code:
<pre id=code><font face=courier size=2 id=code><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<html>
<head>
<title>Order</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Code generated by Cool Web Scrollbars from Harmony Hollow Software-->
<!--www.harmonyhollow.net-->
<STYLE type="text/css">
<!--
BODY {
scrollbar-face-color:#A07F22;
scrollbar-highlight-color:#A07F22;
scrollbar-3dlight-color:#A07F22;
scrollbar-darkshadow-color:#000000;
scrollbar-shadow-color:#A07F22;
scrollbar-arrow-color:#C09B29;
scrollbar-track-color:#000000;
background-color: #000000;
}
-->
<!--End Cool Web Scrollbars code-->
<!--
body {
background-color: #000000;
}
.style8 {
color: #C69F2B;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: xx-small;
}
.style9 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: x-small;
font-weight: bold;
}
.style10 {color: #000000}
.style14 {color: #A07F22}
.style15 {font-weight: bold; font-size: xx-small; font-family: Verdana, Arial, Helvetica, sans-serif;}
.style16 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style17 {color: #A07F22; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style18 {color: #A07F22; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: xx-small; }
.style19 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-weight: bold; }
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<table width="584" border="0" align="center">
<tr>
<td width="550" class="style8"><div align="center" class="style17">Use the form below to give us details of your song. We will send you email updates on the status of your project. To ensure delivery to your inbox (not bulk or junk folders), please add to your email address book.</div></td>
</tr>
</table>
<form name="cart_quantity" action="sendmail.php" method="post">
<input type="hidden" name="recipients" value=" " />
<input type="hidden" name="good_url" value="basstrax.com/catalog/product_info.php?products_id=28" />
<table width="590" border="0" align="center">
<tr>
<td colspan="3" bgcolor="#A07F22"><span class="style9"><img src="spacer.gif" width="22" height="12"><span class="style19">Song info</span></td>
</tr>
<tr>
<td width="163" class="style18"><div align="right">Song Name:</div></td>
<td width="22" class="style18"> </td>
<td width="391" class="style18"><input type="text" name="songname" size="40"></td>
</tr>
<tr>
<td class="style18"><div align="right">Style/Genre:</div></td>
<td class="style18"> </td>
<td class="style18"><input type="text" name="style" size="40"></td>
</tr>
<tr>
<td class="style18"><div align="right">Tempo:</div></td>
<td class="style18"> </td>
<td class="style18"><input type="text" name="tempo">
bpm </td>
</tr>
<tr>
<td class="style18"><div align="right"><span class="style16">Time signiture:</span></div></td>
<td class="style18"> </td>
<td class="style18"><label for="select"></label>
<select name="sig" id="sig">
<option selected>select time sig.</option>
<option>2/4</option>
<option>3/4</option>
<option>4/4</option>
<option>6/8</option>
<option>7/8</option>
<option>not sure</option>
</select> <label></label></td>
</tr>
<tr>
<td class="style18"><div align="right"><span class="style16">Sample Rate:</span></div></td>
<td class="style18"> </td>
<td class="style18"><label for="label"></label>
<select name="rate" id="rate">
<option>44.1 kHz</option>
<option>48 kHz</option>
</select>
<label></label> </td>
</tr>
<tr>
<td class="style18"><div align="right"><span class="style16">Bit-Depth:</span></div></td>
<td class="style18"> </td>
<td class="style18"><label for="label2"></label>
<select name="bit" id="bit">
<option>16 bit</option>
<option>24 bit</option>
</select> <label></label></td>
</tr>
<tr>
<td colspan="3" bgcolor="#A07F22" class="style9"><span class="style10"><img src="spacer.gif" width="22" height="12"><span class="style16">Sound Type/Instrument</span></td>
</tr>
<tr>
<td height="110" colspan="3" class="style8"><table width="240" align="center">
<tr>
<td width="244"><label>
<input type="radio" name="sound" value="frett/elect.">
<span class="style18">Fretted/Elecrtic</span></label></td>
</tr>
<tr>
<td><label> <span class="style14">
<input type="radio" name="sound" value="fless/elect.">
<span class="style15">Fretless/Electric</span></span></label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="sound" value="fless/up">
<span class="style18">Fretless/Upright</span></label></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="3" bgcolor="#A07F22" class="style10"><span class="style19"><img src="spacer.gif" width="22" height="12">Performance</span></td>
</tr>
<tr>
<td colspan="3" class="style8"><table width="240" align="center">
<tr>
<td width="214" class="style8"><label>
<input type="radio" name="perf." value="simple">
<span class="style17">Simple</span></label></td>
</tr>
<tr>
<td class="style8"><label>
<input type="radio" name="perf." value="soph.">
<span class="style17">Sophisticated</span></label></td>
</tr>
<tr>
<td class="style8"><label>
<input type="radio" name="perf." value="both">
<span class="style17">Balance of Both</span></label></td>
</tr>
<tr>
<td class="style8"><label>
<input type="radio" name="perf." value="we decide">
<span class="style17">Let Us Decide</span></label></td>
</tr>
</table>
<p class="style18"> </p></td>
</tr>
<tr>
<td height="18" colspan="3" valign="top" bgcolor="#A07F22" class="style9"><img src="spacer.gif" width="22" height="12"><span class="style16">Additional Info:</span></td>
</tr>
<tr>
<td height="142" colspan="3" valign="top" class="style18"><label for="textarea"></label>
<div align="center">
<textarea name="message" cols="30" rows="10" id="message"></textarea>
</div>
<tr>
<td height="23" colspan="3" valign="top" class="style8"><div align="center">
<input name="Submit" type="submit" class="style9" value="Submit">
</table>
</form>
<p align="center"> </p>
</body>
</html> </font id=code></pre id=code>
Here's the php code:
<pre id=code><font face=courier size=2 id=code> <body>
<?
$songname = $_REQUEST['songname'] ;
$style = $_REQUEST['style'] ;
$tempo = $_REQUEST['tempo'] ;
$sig = $_REQUEST['sig'] ;
$rate = $_REQUEST['rate'] ;
$bit = $_REQUEST['bit'] ;
$sound = $_REQUEST['sound'] ;
$perf. = $_REQUEST['perf.'] ;
$message = $_REQUEST['message'] ;
if (empty($songname)||empty($style)||empty($tempo)||empty($sig)||empty($rate)||empty($bit)||empty($sound)||empty($perf.)||empty($message))
{
header ("Location: error.html"
}
else {
mail(" ", "Online Email Form", "songname", "style", "tempo", "sig", "rate", "bit", "sound", "perf.", "$message", "From: $songname"
header(""basstrax.com/catalog/product_info.php?products_id=28"");
}
?>
</body>
</html>
</font id=code></pre id=code>
Replies
Replied 02 Aug 2006 13:09:35
02 Aug 2006 13:09:35 Roddy Dairion replied:
there you go i've modified it for you. read the comments // there's some modification that you have to do to the form.
<pre id=code><font face=courier size=2 id=code>
<?php
$songname = $_REQUEST['songname'] ;
$style = $_REQUEST['style'] ;
$tempo = $_REQUEST['tempo'] ;
$sig = $_REQUEST['sig'] ;
$rate = $_REQUEST['rate'] ;
$bit = $_REQUEST['bit'] ;
$sound = $_REQUEST['sound'] ;
//can you remove the "." in the field name "perf." please.
$perf = $_REQUEST['perf'] ;
$message = $_REQUEST['message'] ;
//email to send to
$to = " ";
//subject of email
$subject = "Online Email Form";
//email contents
$body=$songname."\n";
$body.=$style."\n";
$body.=$tempo."\n";
$body.=$sig."\n";
$body.=$rate."\n";
$body.=$bit."\n";
$body.$sound."\n";
$body.=$perf."\n\n";
$body.=$message."\n";
//from address should normally be an email address
$from = $songname;
//email format change between html and plain
//default is plain
$format = "plain";
//headers .i.e. When email was sent, the subject, from who, which format.
$headers = "MIME-Version: 1.0\r\n".
"Content-type: text/".$format."; charset=iso-8859-1\r\n".
"From: $from \r\n".
"To: $to \r\n".
"Date: ".date("r"."\r\n".
"Subject: ".$subject."\r\n";
if (empty($songname)||empty($style)||empty($tempo)||empty($sig)||empty($rate)||empty($bit)||empty($sound)||empty($perf)||empty($message))
{
header ("Location: error.html"
}
else {
//mail function format should always be to, subject, email content, headers
mail($to, $subject, $body, $from, $headers);
}
?>
</font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code>
<?php
$songname = $_REQUEST['songname'] ;
$style = $_REQUEST['style'] ;
$tempo = $_REQUEST['tempo'] ;
$sig = $_REQUEST['sig'] ;
$rate = $_REQUEST['rate'] ;
$bit = $_REQUEST['bit'] ;
$sound = $_REQUEST['sound'] ;
//can you remove the "." in the field name "perf." please.
$perf = $_REQUEST['perf'] ;
$message = $_REQUEST['message'] ;
//email to send to
$to = " ";
//subject of email
$subject = "Online Email Form";
//email contents
$body=$songname."\n";
$body.=$style."\n";
$body.=$tempo."\n";
$body.=$sig."\n";
$body.=$rate."\n";
$body.=$bit."\n";
$body.$sound."\n";
$body.=$perf."\n\n";
$body.=$message."\n";
//from address should normally be an email address
$from = $songname;
//email format change between html and plain
//default is plain
$format = "plain";
//headers .i.e. When email was sent, the subject, from who, which format.
$headers = "MIME-Version: 1.0\r\n".
"Content-type: text/".$format."; charset=iso-8859-1\r\n".
"From: $from \r\n".
"To: $to \r\n".
"Date: ".date("r"."\r\n".
"Subject: ".$subject."\r\n";
if (empty($songname)||empty($style)||empty($tempo)||empty($sig)||empty($rate)||empty($bit)||empty($sound)||empty($perf)||empty($message))
{
header ("Location: error.html"
}
else {
//mail function format should always be to, subject, email content, headers
mail($to, $subject, $body, $from, $headers);
}
?>
</font id=code></pre id=code>
Replied 05 Aug 2006 08:00:52
05 Aug 2006 08:00:52 Mark Matthews replied:
Thanks Roddy