|
-
Feb 12th, 2001, 01:52 AM
#1
Thread Starter
Junior Member
I want to give the user the option to order their database search:
im trying the following not working:
<select name ="order">
<option value="price"> price</option>
<option value="size"> size</option>
<option value="date">date </option>
var=request.form("order")
SQL = "SELECT * FROM table ORDER BY 'var'"
im a newbie is there a syntax problem???
thanks
mick
-
Feb 12th, 2001, 04:16 AM
#2
Frenzied Member
try this:
Code:
<%@ Language=VBScript %>
<%option explicit%>
<HTML>
<%
dim od
dim strSQL
od=request("order")
strSQL = "SELECT * FROM table ORDER BY '" & od & "'"
'now use the sql string
response.write strsql
%>
<BODY>
<form action='yz.asp'>
<select name ="order">
<option value="price"> price</option>
<option value="size"> size</option>
<option value="date">date </option>
</select>
<input type=submit>
</form>
</BODY>
</HTML>
-
Feb 12th, 2001, 09:53 AM
#3
Thread Starter
Junior Member
still having trouble
<select name ="order">
<option value="price">price</option>
<option value="size"> size</option>
<option value="date">date </option>
</select>
dim od
od=request.form("order")
SQL ="SELECT * FROM table ORDER BY ' " & od & " ' "
still having problems
-
Feb 12th, 2001, 10:16 AM
#4
Frenzied Member
I presume that this is going to be in an Active Server Page.
If so, copy EXACTLY what I put above into a file.
Make sure the file name matches that in the form's action (so it posts back to itself)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|