Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COnfirmation Page2

Status
Not open for further replies.

jedel

Programmer
Jan 11, 2003
430
AU
OK, I am having no end of trouble here!

I have a form with fields in it

Surname
Firstname
email
Phone

I want to have the user fill in the form. When he clicks on the submit button, it takes hiome to a confirmation page with the data he just filled out the form with.

I've tried using session variables but they do not seem to be carrying across. Here is the code for the form on page one

Code:
<form action="Breakfastconfirn.asp" method="post" enctype="multipart/form-data" name="regForm" id="regForm">
      <table width="393" border="0" align="center" cellpadding="0" cellspacing="1">
        <tr>
          <td width="190" align="right" bgcolor="#CCCCCC" class="Arial12_5">Surname</td>
          <td width="200" bgcolor="#CCCCCC"><input name="txtSurname" type="text" class="Arial12" id="txtSurname" size="40"></td>
          <%Session("surname")=Request.Form("txtSurname")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">First Name </td>
          <td bgcolor="#CCCCCC"><input name="txtFirstName" type="text" class="Arial12" id="txtFirstName" size="40"></td>
          <%Session("firstname")=Request.Form("txtFirstName")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Email</td>
          <td bgcolor="#CCCCCC"><input name="txtEmail" type="text" class="Arial12" id="txtEmail" size="40"></td>
          <%Session("txtemail")=Request.Form("txtEmail")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Phone</td>
          <td bgcolor="#CCCCCC"><input name="txtPh" type="text" class="Arial12" id="txtPh" size="40"></td>
          <%Session("phone")=Request.Form("txtPh")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Cost</td>
          <td bgcolor="#CCCCCC" class="Menutxt">$
            <input name="txtcost" type="text" class="Arial12" id="txtcost" value="<%=(Breakfast.Fields.Item("Cost").Value)%>" size="10" readonly></td>
            <%Session("cost")=Request.Form("txtcost")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Card Type </td>
          <td bgcolor="#CCCCCC"><select name="SelCardType" id="SelCardType">
              <option value="MasterCard">MasterCard</option>
              <option value="Visa">Visa</option>
              <option value="BankCard">BankCard</option>
          </select></td><%Session("cardtype")=Request.Form("SelCardType")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Card No. </td>
          <td bgcolor="#CCCCCC"><input name="txtCardNo" type="text" class="Arial12" id="txtCardNo" size="40"></td><%Session("cardNo")=Request.Form("txtCardNo")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Name on Card </td>
          <td bgcolor="#CCCCCC"><input name="txtCardName" type="text" class="Arial12" id="txtCardName" size="40"></td><%Session("cardname")=Request.Form("txtCardName")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Expiry</td>
          <td bgcolor="#CCCCCC"><select name="SelMonth" id="SelMonth">
              <option value="Jan">Jan</option>
              <option value="Feb">Feb</option>
              <option value="Mar">Mar</option>
              <option value="Apr">Apr</option>
              <option value="May">May</option>
              <option value="Jun">Jun</option>
              <option value="Jul">Jul</option>
              <option value="Aug">Aug</option>
              <option value="Sep">Sep</option>
              <option value="Oct">Oct</option>
              <option value="Nov">Nov</option>
              <option value="Dec">Dec</option>
            </select>
            <select name="SelYear" id="SelYear">
              <option value="2007">2007</option>
              <option value="2008">2008</option>
              <option value="2009">2009</option>
              <option value="2010">2010</option>
              <option value="2011">2011</option>
              <option value="2012">2012</option>
              <option value="2013">2013</option>
              <option value="2014">2014</option>
              <option value="2015">2015</option>
              <option value="2016">2016</option>
              <option value="2017">2017</option>
              <option value="2018">2018</option>
              <option value="2019">2019</option>
              <option value="2020">2020</option>
              <option value="2021">2021</option>
            </select></td>
			<%Session("expmonth")=Request.Form("SelMonth")%>
              <%Session("expyear")=Request.Form("SelYear")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Code</td>
          <td bgcolor="#CCCCCC"><input name="CardCode" type="text" class="Arial12" id="CardCode" size="10"></td><%Session("cardcode")=Request.Form("CardCode")%>
        </tr>
        <tr>
          <td align="right" bgcolor="#CCCCCC" class="Arial12_5">Subscribe me to the XLR8 Men's newsletter </td>
          <td bgcolor="#CCCCCC"><input name="chkSubscribe" type="checkbox" id="chkSubscribe" value="Please Subscribe Me"></td>
          <%Session("subscribe")=Request.Form("chkSubscribe")%>
        </tr>
        <tr>
          <td colspan="2" align="center" bgcolor="#CCCCCC"><label>
            <input type="submit" name="btnConfirm" id="btnConfirm" value="confirm">
          </label></td>
        </tr>
      </table>
      
    </form>

in page two, I thought I could just call the sessions, ie {Session.firstname}

can anybody tell what i'm doing wrong and how I can get the data across to the second page.

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Remember that all of the server-side code runs before that page is sent to the browser.

So at execution time of the ASP listed above there are no values in the Request.Form collection.

The Request.Form collection should be read by code in the page specified by the action property of the <form> tag.
 
I used that method also, ie in the second page I placed Request.Form("txtSurname") etc where I wanted the code and it still did not show.

Can you step through it or send me to a tutorial that steps me through?

Cheers

Dean

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
In Breakfastconfirn.asp

<%
response.write request.form("txtSurname")

'or

Dim strSurname
strSurname = request.form("txtSurname")
%>
 
Workwise

Sorry, not working i've tried both methods in a whole range of different ways. Nothing works.

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Sheco explained it. When you are on the page that contains the form, there is nothing in the Request.Form collection. So everywhere that you have Session("x")=Request.Form("x") on the page above, it won't work. Remove all of those and then on Breakfastconfirn.asp just do Request.Form("x") for all form items.
 
ethorn10,

AS I explained before, I d id this in a number of different ways with not success.

Here is a snippet of code from the Breakfastconfirm.asp page:

Code:
<form name="form1" method="POST" action="<%=MM_editAction%>">
      <table width="57%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="27%" height="23" align="right" class="Menutxt">Surname</td>
          <td width="73%">[b]<%  
		   response.Write request.form("txtSurname")
		  
		  %>[/b]</td>
        </tr>

I have tried doing this method as well as just "request.form("txtSurname"), Trying a string variable, it just does seem to carry the data accross to the second page.

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
OK, I think I have it

Firstly, my form had the wrong enctype; "enctype="multipart/form-data" So I removed it altogether.

Second. Instead of <%request.form("txtSurname")%>; it was <% = request.form("txtSurname")%>. The equals sign speaks volumes

Thanks for your help guys

Dean



-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top