|
|
 |
BOOK: Beginning JavaScript  | This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning JavaScript section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |
|

July 13th, 2004, 11:50 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It looks like it does not pick up a value for StockId. This is the code from the form:
<input type="hidden" name="txtStockId" VALUE="<%Request.QueryString("StockId")%>">
which is supposed to retreive the StockId from the database.
|

July 13th, 2004, 12:05 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Request.QueryString retrieves values from the address bar, not a database.
Snib
<><
|

July 14th, 2004, 03:19 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry, it is suppose to retrieve it from the address bar, but it doesn't, although i can clearly see the value in the address bar.
|

July 14th, 2004, 05:25 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|

July 14th, 2004, 10:12 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ohhhhhhhhhhh OK i see the problem now. You're missing an equals sign:
<input type="hidden" name="txtStockId" VALUE="<%Request.QueryString("StockId")%>">
should be:
<input type="hidden" name="txtStockId" VALUE="<%=Request.QueryString("StockId")%>">
Man, I can't believe I didn't catch that.... ;)
HTH,
Snib
<><
|

July 14th, 2004, 11:03 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Cheers Mate, that sorted it.
|

February 22nd, 2005, 01:43 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm having the same problem. I have used the book code plus the suggested code from terry s above - still getting a syntax error problem.
Here's my code that supplies the data: -
<body bgcolor="#FFFFFF">
<p align="center">Please enter your customer ID and the number of seats you would
like to reserve</p>
<form name="form1" language=JavaScript method="post" action="AddTable.asp" onsubmit="return form1_onsubmit()">
<input type="text" name=txtBook_ID value="<%=Request.QueryString("Booking_ID")%>">
<input type="text" name=txtDate value="<%=Request.QueryString("DateBooked")%>">
<input type="text" name=txtTime value="<%=Request.QueryString("Time")%>">
<input type="text" name=txtSeatNo value="<%=Request.QueryString("SeatsRemaining")%>" >
<table width="700" border="1" align="center">
<tr>
<td>
<div align="right">Customer ID</div>
</td>
<td>
<input type="text" name="txtCustID">
</td>
<td>
<div align="right">Number of Seats</div>
</td>
<td>
<input type="text" name="txtSeatNo">
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="reset" name="Reset" value="Reset">
</div>
</td>
<td colspan="2">
<div align="center">
<input type="submit" name="Submit" value="Book this table">
</div>
</td>
</tr>
</table>
</form>
<p> </p>
<p align="center"> </p>
<p> </p>
</body>
And the code on the page that inserts the data: -
<%
var ci = Request.Form("txtCustID");
var dt = Request.Form("txtDate");
var tm = Request.Form("txtTime");
var sn = Request.Form("txtSeatNo");
adoConnection = Server.CreateObject("ADODB.Connection");
adoConnection.Open("DSN=SunInnDB");
var SQL = "INSERT INTO tblBookings (CustID,Date,Time,SeatsBooked)";
SQL = SQL + "VALUES('"+ci+"','"+dt+"','"+tm+"','"+sn+"')";
adoConnection.Execute(SQL);
adoConnection.Close();
adoConnection = null;
%>
Help appreciated
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |