Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Unanswered: Display form entries

    Hi guyz, when inserting data from a form into my db i want to show the user what they have entered... Would i be able to display all the fields on a page, like a 'thank you for completing the form' page?
    Also how do i get the submit button to redirect me to another page and not just a plain document. My form code is shown below (addMembershsip.asp), along with the connectionString.asp file which insert my data into the db. Any help or links would be helpful. Thanks for ur time.


    connectionString.asp
    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <% 
    Dim Conn, MySQL ' set connection
    ConnString = "Driver={MySQL};SERVER=localhost;DATABASE=punjab;UID=zoooz;PASSWORD=mypass" 
    Set Conn = Server.CreateObject("ADODB.Connection") 
    Conn.Open ConnString 
    
    'insert data to members table
    If Conn.State = 1 Then
    	MySQL = "INSERT INTO members (Forename, surname, Address1, Address2, Address3, PostCode, Date_of_birth, Telephone, Email, Password, Username, Type)"
    	mySQL = mySQL & " VALUES ('" & request.form("Forename") & "','" & request.form("surname") & "','" & request.form("address1") & "','" & request.form("address2") & "','" & request.form("address3") & "','" & request.form("PostCode") & "','" & request.form("DOB") & "','" & request.form("Telephone") & "','" & request.form("Email") & "','" & request.form("Password") & "','" & request.form("Username") & "','" & request.form("MemType") & "')"
    	'& "','" & request.form("xMeal") & "','" & request.form("hotelYesNo") & "','" & request.form("arrivalDate") & "','" & request.form("departureDate") & "','" & request.form("roomType") & "','" & request.form("bedSize")  & "','" & request.form("roomMate") & "','" & request.form("totalInRoom") & "','" & request.form("creditCardType") & "','" & request.form("creditCardNo") & "','" & request.form("cardHoldersName") & "','" & request.form("expDate")
    	
    	Conn.Execute mySQL
    	Conn.Close
    End If
    
    Set Conn = Nothing
    %>
    <body>
    
    </body>
    </html>
    AddMemberhsip.asp

    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form name="AddMember" method="POST" action="ConnectionString.asp">
      <p><strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif">Membership 
        Application</font></strong></p>
      <p><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Please completely 
        fill the following form correctly. Email Address must be valid to complete 
        your application.</font></p>
      <p>&nbsp;</p>
      <table width="92%" border="0">
        <tr> 
          <td width="20%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Forename</label>
            </font></td>
          <td width="38%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label> 
            <input type="text" name="Forename">
            </label>
            </font></td>
          <td width="9%">&nbsp;</td>
          <td width="33%">&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Surname</label>
            &nbsp;</font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="surname">
            </font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Address1 </label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Address1">
            </font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Address2</label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Address2">
            </font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Address3 </label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Address3">
            </font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Post Code</label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="PostCode">
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Password</label>
            &nbsp;</font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Password">
            Minimum Lenght of 5 </font></td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Date Of Birth</label>
            &nbsp;</font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="DOB">
            eg. yyyy-mm-dd</font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Username</label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Username">
            </font></td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Telephone Number</label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Telephone">
            </font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <label>Email Address</label>
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
            <input type="text" name="Email">
            </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Type</font></td>
          <td><select name="MemType">
              <option>Adult</option>
              <option>Child</option>
            </select></td>
        </tr>
        <tr> 
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p> 
        <input type="submit" name="Submit" value="Next">
      </p>
      <input type="hidden" value="AddMember">
    </form>
    </body>
    </html>
    Thanks again.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    After inserting the code you can do whatever you like.....eg
    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <% 
    Dim Conn, MySQL ' set connection
    ConnString = "Driver={MySQL};SERVER=localhost;DATABASE=punjab;UI  D=zoooz;PASSWORD=mypass" 
    Set Conn = Server.CreateObject("ADODB.Connection") 
    Conn.Open ConnString 
    
    'insert data to members table
    If Conn.State = 1 Then
    	MySQL = "INSERT INTO members (Forename, surname, Address1, Address2, Address3, PostCode, Date_of_birth, Telephone, Email, Password, Username, Type)"
    	mySQL = mySQL & " VALUES ('" & request.form("Forename") & "','" & request.form("surname") & "','" & request.form("address1") & "','" & request.form("address2") & "','" & request.form("address3") & "','" & request.form("PostCode") & "','" & request.form("DOB") & "','" & request.form("Telephone") & "','" & request.form("Email") & "','" & request.form("Password") & "','" & request.form("Username") & "','" & request.form("MemType") & "')"
    	'& "','" & request.form("xMeal") & "','" & request.form("hotelYesNo") & "','" & request.form("arrivalDate") & "','" & request.form("departureDate") & "','" & request.form("roomType") & "','" & request.form("bedSize")  & "','" & request.form("roomMate") & "','" & request.form("totalInRoom") & "','" & request.form("creditCardType") & "','" & request.form("creditCardNo") & "','" & request.form("cardHoldersName") & "','" & request.form("expDate")
    	
    	Conn.Execute mySQL
    	Conn.Close
    End If
    
    Set Conn = Nothing
    %>
    <body>
    Forename = <%=request.form("Forename")%><br>
    surname= <%=request.form("surname")%><br>
    address1= <%=request.form("address1")%><br>
    address2= <%=request.form("address2")%><br>
    address3= <%=request.form("address3")%><br>
    PostCode= <%=request.form("PostCode")%><br>
    etc....
    </body>
    </html>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •