Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2006, 06:49 AM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strange problem passing values

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:
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"><%=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!

 
Old November 30th, 2006, 07:43 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
 
Old December 1st, 2006, 03:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing null values maddy137 ASP.NET 1.0 and 1.1 Basics 1 May 7th, 2006 12:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.