|
Subject:
|
Strange problem passing values
|
|
Posted By:
|
Protoman
|
Post Date:
|
11/30/2006 5:49:55 AM
|
I've got a contact form, that when filled in and submitted it will e-mail the information entered into the form to the staff on the other end.
Now, I have written similar forms before without any problems, but this time, I'm having one huge one, but I can't place my finger on what I've done wrong.
The values are coming through as either "undefined" or "false".
Here's my code:
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" style="padding: 25px;">
<table height="100" cellpadding="0" cellspacing="0" border="0" bgcolor="#EADFC9">
<tr>
<td valign="top" style="padding: 5px;">
<table height="400" width="200" cellpadding="0" cellspacing="0" border="0" bgcolor="#F7ECD6">
<tr>
<td class="altColorBoxTop" valign="middle" height="50" colspan="3"><img src="/portals/10/skins/edmonds and slatter/images/callback.gif" /></td>
</tr>
<%
if (Request.Querystring("submit")!="true")
{
%>
<FORM METHOD="POST" ACTION="callback.asp?submit=true">
<tr>
<td valign="top" style="padding-left: 5px;" colspan="3" class="altColorBox"><b>Name:</b></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" colspan="3"><input type="text" name="fullname" /></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" colspan="3" class="altColorBox"><b>Tel. No.:</b></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px; " colspan="3" ><input type="text" name="telephone" /></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" colspan="3" class="altColorBox"><b>E-mail Address:</b></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px; " colspan="3"><input type="text" name="email" /></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" colspan="3" class="altColorBox"><b>Nearest Location:</b></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px; " colspan="3">
<SELECT NAME="nearest">
<option value="-1">Select the nearest location</option>
<option value="99">------------------</option>
<option value="Blaby">Blaby</option>
<option value="Glenfield">Glenfield</option>
<option value="Lutterworth">Lutterworth</option>
</SELECT>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;"><INPUT TYPE="checkbox" NAME="Appointments" value="Yes"></td>
<td valign="middle" style="padding-left: 5px;" colspan="2" class="altColorBox" >Appointments</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;"><INPUT TYPE="checkbox" NAME="FramesAvail" value="Yes"></td>
<td valign="middle" style="padding-left: 5px;" colspan="2" class="altColorBox">Frames Availability</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;"><INPUT TYPE="checkbox" NAME="LensAdvice" value="Yes"></td>
<td valign="middle" style="padding-left: 5px;" colspan="2" class="altColorBox">Lens Advice</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;"><INPUT TYPE="checkbox" NAME="ContactLenses" value="Yes"></td>
<td valign="middle" style="padding-left: 5px;" colspan="2" class="altColorBox">Contact Lenses</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" class="altColorBox" colspan="3">Other/Comments:</td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px;" class="altColorBox" colspan="3"><TEXTAREA NAME="Comments" ROWS="5" COLS="30"></TEXTAREA></td>
</tr>
<tr>
<td valign="top" style="padding-left: 5px; padding-bottom: 10px;" class="altColorBox" colspan="3" align="right"><INPUT TYPE="image" src="/portals/10/skins/edmonds and slatter/images/submit.gif" onClick="return checkLogin(this.form);" /></td>
</tr>
</FORM>
<%
} else {
//set up variables for mail content
var tName = Request.Form("fullname").value;
var tPhone;
var tEmail;
var tLocation = Request.Form("nearest").value;
var tAppointments = Request.Form("Appointments").value;
var tFrames;
var tLenses;
var tContacts;
var tComments;
if (Request.Form("telephone").value == "")
{
tPhone = "Not Supplied";
} else {
tPhone = Request.Form("telephone").value;
}
if (Request.Form("email").value == "")
{
tEmail = "Not Supplied";
} else {
tEmail = Request.Form("email").value;
}
if (Request.Form("Appointments").checked == true)
{
tAppointments = "Yes";
} else {
tAppointments = "No";
}
if (Request.Form("FramesAvail").checked == true)
{
tFrames = "Yes";
} else {
tFrames = "No";
}
if (Request.Form("LensAdvice").checked == true)
{
tLenses = "Yes";
} else {
tLenses = "No";
}
if (Request.Form("ContactLenses").checked == true)
{
tContacts = "Yes";
} else {
tContacts = "No";
}
if (Request.Form("Comments").value == "")
{
tComments = "None";
} else {
tComments = Request.Form("Comments").value;
}
//This contains the contents of the e-mail
//we are sending to E&S
var tBody = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Name:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tName;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Telephone number:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tPhone;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>E-mail address:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tEmail;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Nearest Location:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tLocation;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Appointments:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tAppointments;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Frames Available:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tFrames;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Lens Advice:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tLenses;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Contact Lenses:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tContacts;
tBody += "</td>";
tBody += "</tr>";
tBody += "<tr>";
tBody += "<td valign=\"top\">";
tBody += "<b>Other/Comments:</b>";
tBody += "</td>";
tBody += "<td valign=\"top\">";
tBody += tComments;
tBody += "</td>";
tBody += "</tr>";
//Response.write(tBody);
%>
<tr>
<td valign="top" style="padding-left: 5px;" class="altColorBox"><!--Thank you for contacting us, someone from Edmonds and Slatter will be contacting you shortly.--><%=tBody%></td>
</tr>
<%
} %>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>
The page isn't yet complete as during debugging, I came up against the above problem. Please help!
|
|
Reply By:
|
mat41
|
Reply Date:
|
11/30/2006 6:43:38 PM
|
Without wading through your reams of code (you should post the problemtic code only for the quickest and most useful solution) I a bit confused:
> You use { and } this is not an .asp page? I assume its a .jsp page? Which would mean its in the wrong area of this forum.
FYI ASP does not use { } syntax. I can run your page if I give it a .jsp suffix - it will not run as an asp page.
Wind is your friend Matt
|
|
Reply By:
|
Imar
|
Reply Date:
|
12/1/2006 2:21:15 AM
|
quote: FYI ASP does not use { } syntax.
It does, when JavaScript is your preferred server side language....
Imar --------------------------------------- Imar Spaanjaars http://Imar.Spaanjaars.Com Everyone is unique, except for me. Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004 Want to be my colleague? Then check out this post.
|