Using Form values on another page

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Using Form values on another page

    Hi,

    I have completed my first ecommerce online catalogue after many frustrating
    weeks all except this one last problem.

    I have a page where users can enter their own Personalised message to go on
    the product they select. When they submit the form (which inserts a record
    into a database) I want it to go to a validation page where they can review
    what they have just entered and then add the item to their cart.

    I can get the form to submit a new record without a problem, however, on the
    validation page I can't bring up the correct record - it seems to be bringing
    up the first record in the table each time.

    Following is the code for the form:


    <form method="POST" action="<%=MM_editAction%>" name="form1">
    <table align="center">
    <tr valign="baseline">
    <td nowrap align="right">Personalise
    Option:</td>
    <td><input name="PersonaliseOption"
    type="text"
    onBlur="MM_validateForm('PersonaliseOption','','R' ,'FirstName','','R','LastName'
    ,'','R','StreetAddress','','R','City','','R','Stat e','','R','Postcode','','RisNu
    m');return document.MM_returnValue" value="Your Name?" size="26">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">First Name:</td>
    <td><input type="text" name="FirstName"
    value="" size="26">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Last Name:</td>
    <td><input type="text" name="LastName"
    value="" size="26">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Street
    Address:</td>
    <td><input type="text"
    name="StreetAddress" value="" size="26">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">City:</td>
    <td><input type="text" name="City"
    value="" size="26">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">State:</td>
    <td><input type="text" name="State"
    value="" size="6">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Postcode:</td>
    <td><input type="text" name="Postcode"
    value="" size="6">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">&nbsp;</td>
    <td><input type="submit" class="titlebar"
    value="Personalise">
    </td>
    </tr>
    </table>
    <input type="hidden" name="OdrProductID"
    value="<%=(rsMaster.Fields.Item("ProductId").Value )%>" size="32">
    <input type="hidden" name="MM_insert"
    value="form1">
    </form>


    the address that I have set up after the form has submitted is:
    /Personalise/validation.asp?ID=" + cStr(Request.Form("OrderID")) + "

    so it is going to the "validation.asp" page with a paramater of ID = OrderID
    from the form. OrderID is the primary key in the table and is set up as a auto
    number.



    On the "validation.asp page I have a recordset set using the "Personalise"
    table with a paramater of "OrderID = Request.Form("OrderID") along with the
    bindings I require for the page.

    The code for the recodrset looks like this:

    <%
    Dim rsOrder__MMColParam
    rsOrder__MMColParam = "1"
    If (Request.Form("OrderID") <> "") Then
    rsOrder__MMColParam = Request.Form("OrderID")
    End If
    %>
    <%
    Dim rsOrder
    Dim rsOrder_numRows

    Set rsOrder = Server.CreateObject("ADODB.Recordset")
    rsOrder.ActiveConnection = MM_connNC05_STRING
    rsOrder.Source = "SELECT OrderID, PersonaliseOption, OdrProductID FROM
    Personalise WHERE OrderID = " + Replace(rsOrder__MMColParam, "'", "''") + ""
    rsOrder.CursorType = 2
    rsOrder.CursorLocation = 3
    rsOrder.LockType = 1
    rsOrder.Open()

    rsOrder_numRows = 0
    %>


    and in the appropriate place I am binding the "PersonalOption" to placeholder
    text on my page.

    The code for that being:

    <%=(rsOrder.Fields.Item("PersonaliseOption").Value )%>


    Can anyone help me out as to why it is calling up the first record in the
    Personalised table rather than the one from the record the user has just
    inserted via the form page?

    I would be very appreciative If some one can solve this for me.

    Thanks

    iamtheeggman Guest

  2. Similar Questions and Discussions

    1. How to access values of form fields on am action page?
      I am sending few form fields to the action page. Here is what it receives (from CF debugging info): Form Fields: 58707001=TBD 587627_01=TBD...
    2. Populate form values based on previous same form fields
      This message is cross posted in alt.comp.lang.php & comp.lang.javascript I have a form for a user to input an establishment's hours and what time...
    3. Form submission fills form values with garbage
      Hey all, I'm attempting to do some form processing on a server that has register_globals off, however, I've run into a confusing situation and...
    4. Accessing Values of local variables in previous page when using custom error page
      Hello, I have created a nice funky 500 - 100 error page which gives a nicer error; happily loops through and supplies querysting information, all...
    5. using form values on same page
      I have a selection menu on a page. I want to be able to select an item from the menu and press a button to set a session variable and display the...
  3. #2

    Default Re: Using Form values on another page

    It is (i think) because you are requesting the OrderID from Request.Form and as
    you are redirecting to validation.asp using a url (not a form post) it is not
    finding it.

    You need to change the following on validation.asp:

    If (Request.Form("OrderID") <> "") Then
    rsOrder__MMColParam = Request.Form("OrderID")

    to:

    If (Request.QueryString("OrderID") <> "") Then
    rsOrder__MMColParam = Request.QueryString("OrderID")

    that should sort it.


    boy mackman Guest

  4. #3

    Default Re: Using Form values on another page

    Boy Mackman,

    Thanks for the response.

    I tried the code you provided and now instead of bringing the first record in
    the "Personalise Table" it displays the error message saying that the record
    (that I just created via the insert form) doesn't exist.

    Any other suggestions?

    iamtheeggman

    iamtheeggman Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139