|
#1
|
|||
|
|||
|
Anyone please help with asp
Can anyone please help me with this asp sample?
I know that many of you are into php but I recall one of you helping me with asp before. I have a selection box where I can choose country, after I select the country a table is created with 3 columns from the database I then want to post the record from column 1 to a processform.asp "which works fine" this column is called companyname. Here is what I have <html> <body> <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb")) set rs=Server.CreateObject("ADODB.recordset") sql="SELECT DISTINCT Country FROM Customers ORDER BY Country" rs.Open sql,conn country=request.form("country") %> <form method="post"> Choose Country <select name="country"> <% do until rs.EOF response.write("<option") if rs.fields("country")=country then response.write(" selected") end if response.write(">") response.write(rs.fields("Country")) rs.MoveNext loop rs.Close set rs=Nothing %> </select> <input type="submit" value="Show customers"> </form> <% if country<>"" then sql="SELECT Companyname,Contactname,Country FROM Customers WHERE country='" & country & "'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,conn %> <table width="100%" cellspacing="0" cellpadding="2" border="1"> <tr> <th>Companyname</th> <th>Contactname</th> <th>Country</th> </tr> <% do until rs.EOF response.write("<tr>") response.write("<td>" & rs.fields("companyname") & "</td>") \\I want to post this to the next page response.write("<td>" & rs.fields("contactname") & "</td>") response.write("<td>" & rs.fields("country") & "</td>") response.write("</tr>") rs.MoveNext loop rs.close conn.Close set rs=Nothing set conn=Nothing%> </table> <% end if %> </body> </html> If anyone can help with this it will be very much appreciated. Thanks Guys. |
|
#2
|
|||
|
|||
|
Im a little bit confused as to what you want to do so may have the worng end of the stick.
If you want to send the value from this page to the next you could include it inside your form. <input type="text" value="<%=rs.fields("companyname")%>"> You could also do <input type="hidden" value="<%=rs.fields("companyname")%>"> If you wanted to pass a value but not display it to the user. |
|
#3
|
|||
|
|||
|
sorry that should be:
<input type="text" name="a_name" value="<%=rs.fields("companyname")%>"> |
|
#4
|
|||
|
|||
|
Thanks Philo,
It does not sem to work but I will keep trying, I appreciate your help. |
|
#5
|
|||
|
|||
|
Ensure that line is within your form tags
Alternatively Have you tried session variables? Try Session("companyname") = rs.fields("companyname") Then you can return it on any future pages by doing Dim companyname companyname = Session("companyname") Have a look here for more info http://www.w3schools.com/asp/asp_sessions.asp |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check if allowed to update using ASP and Trueupdate | nickw | TrueUpdate 1.0 | 4 | 06-20-2003 02:13 PM |
| ASP Web Get/Post | greenace | Setup Factory 6.0 | 9 | 06-07-2003 12:01 AM |
| Submit to web ASP | kaylward | Setup Factory 6.0 | 1 | 11-30-2002 08:15 PM |
| True Update from ASP | day10 | TrueUpdate 1.0 | 3 | 08-08-2002 04:07 PM |
All times are GMT -6. The time now is 10:20 PM.








Linear Mode

