Log in

View Full Version : The "Submit" Question



Slither
05-07-2007, 09:07 PM
Ok I have been looking for hours and can't seem to find anything to help me. I run a Mustang website with a registry on it so people can register their car information. I have the entire thing setup and need an email sent to me when they hit the "submit" button. I have tried and tried but can't get it. My email is mahnotinknee@yahoo.com and the code is below:

If anyone can show me where to put my email or just copy and re-paste the code with the required html that would be fantastic! I took out most of the state options to shorten the code for this forum.

<script>
function validateForm() {
with (document.SMR) {
var alertMsg = "Please look back and fill in these required fields:\n";
if (NAME.value == "") alertMsg += "\nName";
if (CITY.value == "") alertMsg += "\nCity";
if (EMAIL.value == "") alertMsg += "\nE-Mail";
if (STATE.options[STATE.selectedIndex].value == "") alertMsg += "\nState";
if (MODEL_YEAR.options[MODEL_YEAR.selectedIndex].value == "") alertMsg += "\nModel Year";
if (MODEL_TYPE.options[MODEL_TYPE.selectedIndex].value == "") alertMsg += "\nModel Type";
if (BODY_COLOR.value == "") alertMsg += "\nBODY_COLOR";
if (BODY_STYLE.options[BODY_STYLE.selectedIndex].value == "") alertMsg += "\nBody Style";
if (TRANSMISSION.value == "") alertMsg += "\nTransmission";
if (INTERIOR_TYPE.value == "") alertMsg += "\nInterior Type";
if (INTERIOR_COLOR.value == "") alertMsg += "\nInterior Color";
if (BODY_STYLE.options[BODY_STYLE.selectedIndex].value == "Convertible" &&
TOP_COLOR.selectedIndex == 0)
alertMsg += "\nTop Color is Required for Convertibles";


if (alertMsg != "Please look back and fill in these required fields:\n") {
alert(alertMsg);
return false;
} else {
return true;
} } }

</script>

<style>
.regheader {
text-align: right;
font-weight: bold;
font-family: "Times New Roman";
color: #000000;
width: 45%;
}

</style>
</head>
<body bgcolor="#ffffff" link="#800000" vlink="#996600" text="#000000" topmargin=0 leftmargin=0>
<table>
<tr>

<td>
</table>

<FORM METHOD="POST" onsubmit="return validateForm()" name="Silver Mustang Registry">
<table border="0" width=550 height=300>
<tr valign="top">


</tr>
</table>
<br />
<a name="Silver Mustang Registry"></a>
<table bordercolor="black" width="500" align="center">
<tr bgcolor="black">

</tr>
<tr>
<td colspan="2"><font color="blue">Personal Information:</font></td>
</tr>
<tr>
<td class="regheader" ></font>First, Last Name:</td>
<td><input name="NAME" maxlength=75 size=44 type="text" value=""></td>

</tr>
<tr>
<td class="regheader" >Registered User Name:</td>
<td><input name="ADDRESS" maxlength=50 size=44 type="text" value=""></td>
</tr>
<tr>
<td class="regheader"></font>City:</td>

<td><input name="CITY" maxlength=75 size=20 type="text" value=""></td>
</tr>
<tr>
<td class="regheader"></font>State: </td>
<td><select name="STATE" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select State</option>
<option value="--" >Other</option>
<option value="AK" >AK</option>

<option value="AL" >AL</option>
<option value="AR" >AR</option>

</select>
</td>
</tr>
<tr>
<td class="regheader"></font>Zip: </td>

<td><input name="ZIP" maxlength=10 size=6 type="text" value=""></td>
</tr>
<tr>
<td class="regheader"></font>Country:</td>
<td><input name="COUNTRY" maxlength=50 size=35 type="text" value="USA"></td>
</tr>
<tr>
<td colspan="2"><font face="Times New Roman" color=#000000 size=4><font color="blue">Car Information:</font></font></td>

</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3></font>Year:</font>&nbsp;</td>
<td><select name="MODEL_YEAR" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select Year</option>
<option value="2008" >2008</option>
<option value="2007" >2007</option>
<option value="2006" >2006</option>

<option value="2005" >2005</option>
<option value="2004" >2004</option>
<option value="2003" >2003</option>
<option value="2002" >2002</option>
<option value="2001" >2001</option>
<option value="2000" >2000</option>
<option value="1999" >1999</option>
<option value="1998" >1998</option>
<option value="1997" >1997</option>

<option value="1996" >1996</option>
<option value="1995" >1995</option>
<option value="1994" >1994</option>
<option value="1993" >1993</option>
<option value="1992" >1992</option>
<option value="1991" >1991</option>
<option value="1990" >1990</option>
<option value="1989" >1989</option>
<option value="1988" >1988</option>

<option value="1987" >1987</option>
<option value="1986" >1986</option>
<option value="1985" >1985</option>
<option value="1984" >1984</option>
<option value="1983" >1983</option>
<option value="1982" >1982</option>
<option value="1981" >1981</option>
<option value="1980" >1980</option>
<option value="1979" >1979</option>

<option value="1978" >1978</option>
<option value="1973" >1973</option>
<option value="1972" >1972</option>
<option value="1971" >1971</option>
<option value="1970" >1970</option>
<option value="1969" >1969</option>
<option value="1968" >1968</option>
<option value="1967" >1967</option>
<option value="1966" >1966</option>

<option value="1965" >1965</option>
<option value="1964.5" >1964 1/2</option>
<option value="Other" >Other:Specify in Comments</option>
</select>
</td>
</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3></font>Model: </td>
<td><select name="MODEL_TYPE" size="1" >

<option style="color: green; font-weight:bold" value="" SELECTED >Select Model</option>
<option value="GT" >GT</option>
<option value="V6" >V6</option>
<option value="Cobra" >Cobra</option>
<option value="Mach 1" >Mach 1</option>
<option value="Roush" >Roush</option>
<option value="Saleen" >Saleen</option>
<option value="Boss" >Boss</option>
<option value="GTS" >GTS</option>
<option value="LX" >LX</option>
<option value="5.0 LX" >5.0 LX</option>
<option value="Other" >Other</option>
</select>
</td>
</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3></font>Body Style:</td>
<td>

<select name="BODY_STYLE" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select Body Style</option>
<option value="Coupe" >Coupe</option>
<option value="Convertible" >Convertible</option>
<option value="Fastback" >Fastback</option>
<option value="Hatchback" >Hatchback</option>
</select>
</td>
</tr>

<td class="regheader"><font face="Times New Roman" color=#000000 size=3>&nbsp; Convertible Top Color</font></font></font></b><br />

</td>
<td><select name="TOP_COLOR" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select Top Color</option>
<option value="Black" >Black</option>
<option value="White" >White</option>
<option value="Tan" >Tan</option>
</select>

</td>
</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3><b></font>Transmission:</td>
<td><select name="TRANSMISSION" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select Transmission</option>
<option value="Manual" >Manual</option>
<option value="Auto" >Automatic</option>

</select>
</td>
</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3></font>Seat Material:</td>
<td><select name="INTERIOR_TYPE" size="1" >
<option style="color: green; font-weight:bold" value="" SELECTED >Select Material</option>
<option value="Leather" >Leather</option>
<option value="Cloth" >Cloth</option>
<option value="Vinyl" >Vinyl</option>
<option value="Comfortweave" >Comfortweave</option>
<option value="Other" >Other</option>
</select>
</td>
</tr>
<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3></font>Interior Color:</font></td>
<td><select name="INTERIOR_COLOR" size="1" >

<option style="color: green; font-weight:bold" value="" SELECTED >Select Color</option>
<option value="Black" >Black</option>
<option value="Charcoal" >Dark Charcoal</option>
<option value="White" >White</option>
<option value="Grey" >Light Grey</option>
<option value="Blue" >Blue</option>
<option value="Red" >Red</option>
<option value="Other" >Other</option>
</select>

</td>

<tr>
<td class="regheader"></font><font face="Times New Roman" color=#000000 size=3>VIN # (Optional):</td>

<td><input name="VIN" maxlength=25 size=30 type="text" value=""></td>
</tr>

<tr>
<td class="regheader"><font face="Times New Roman" color=#000000 size=3>&nbsp; If "Other" was selected, please specify:</b></font></td>

<td><textarea name="COMMENTS" rows=7 cols=35></textarea></td>
</tr>
<tr>
<td colspan="2"><center><input value="Submit" type="submit"></center></td>
</tr>
</table>
</td>
</tr>

</table>
</form>
</body>

</html>

thetestingsite
05-07-2007, 09:11 PM
First off, you would need a server side scripting language (PHP, ASP, etc) to process the form and send the email. You could look around these forums for a "Form Mail" script as there are several floating around. The only other option would be to have; in the action of the form (<form action=...), mailto: youremail@domain.com. Although, this route would require the user to actually "send" the email from their email client.

Either way, hope this helps.

techno_race
05-08-2007, 01:45 AM
<FORM METHOD="POST" onsubmit="return validateForm()" name="Silver Mustang Registry">

Replace that with:

<FORM METHOD="POST" onsubmit="return validateForm()" name="Silver Mustang Registry" action="mailto:blablabla@whatever.bla">

like thetestingsite said.
(I had to replace [HTML] with [CODE] in the code that's not quoted so it would recognize my [B] and [I] tags.)

Slither
05-08-2007, 02:06 AM
GREAT! That worked. But what if they don't have Outlook or something similar? Is there a way to get around that or is there another way you could suggest with the code that I currently have?

techno_race
05-08-2007, 02:10 AM
The only way around that would be PHP's integrated mail function.
However, I'm not entirely sure if even that would work.
I doubt it would. How would it know who to email it from?
Don't worry, you can usually trust that most everybody viewing websites would have an e-Mail client. :p

techno_race
05-08-2007, 02:14 AM
By the way:
You should have "other" as an option for Body Style; we have an SUV. :p

Slither
05-08-2007, 11:49 AM
Haha! Well its a registry for silver Mustangs. You can check it out if you want.

www.SilverMustangs.com

I did all the graphics also.

Thanks again