Ask a Question related to Dreamweaver AppDev, Design and Development.
-
iamtheeggman #1
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"> </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
-
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... -
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... -
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... -
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... -
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... -
boy mackman #2
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
-
iamtheeggman #3
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



Reply With Quote

