หน้า search.html ค่ะ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<HEAD><TITLE>Radio Button Test</TITLE>
<SCRIPT Language="JavaScript">
function test() {
var t1=document.testForm
var a = t1.Product.value.indexOf('.')
var b = t1.Product.value.indexOf('"')
var f = t1.Product.value.indexOf("'")
var c = t1.Product.value
var d = t1.Price.value
if (t1.rad[0].checked) {
t1.Product.focus();
if(c==""){
alert("Please input Product");
t1.Product.focus();
return false;
}
else {
if(a==0||b==0||f==0){
alert("Please verify textfileld should only have text ");
t1.Product.focus();
return false;}
}
t1.Product.focus();
return true;
}
if(t1.rad[1].checked){
if(d==""){
alert("Please input Price");
t1.Price.focus();
return false;
}
else{
if(isNaN(t1.Price.value)){
alert("Price must be number");
t1.Price.focus();
return false;
}
}
<a href = "serach.html">Back to search page<br><br><br></a>
<%
Dim connStr
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Northwind.mdb")
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
Dim x,y,sql,z,t,w,pagenum
x = Request.form("rad")
y = Request.form("Product")
Z = Request.Form("SYMBOL")
t = Request.Form("price")
If x= "" Then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products "
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else
If x ="rad_button1" then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE ((ProductName LIKE '"&y&"%')) "
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else If x="rad_button2" Then
If z = "=" then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE UnitPrice = "&t
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else If z = "<" Then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE UnitPrice <"&t
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else If z = "<=" Then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE UnitPrice <="&t
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else If z = ">=" Then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE UnitPrice >= "&t
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
Else If z = ">" Then
sql ="SELECT ProductName,QuantityPerUnit,UnitPrice,UnitsInStock FROM Products WHERE ((UnitPrice > "&t
Response.write "<center>Search by<br>"&sql
Response.write "</center>"
End If
End If
End If
End If
End If
If Not rs.EOF Then
If Len(Request("pagenum")) = 0 Then
rs.AbsolutePage = 1
Else If CInt(Request("pagenum")) <= rs.PageCount Then
rs.AbsolutePage = Request("pagenum")
Else
rs.AbsolutePage = 1
End If
End If
Dim abspage, pagecnt
abspage = rs.AbsolutePage
pagecnt = rs.PageCount
Response.Write "<br><br>Total Page : " & rs.PageCount & "<br>" & vbcrlf
Response.Write "Absolute Page : " & rs.AbsolutePage & "<br>" & vbcrlf
Response.Write "Total number of records : " & rs.RecordCount & "<br><br>" & vbcrlf
Dim fldF, intRec
Response.Write "<table border=1 align=center cellpadding=3 cellspacing=0><thead><tr bgcolor=""#99FF66"">"
For Each fldF in rs.Fields
Response.Write "<td >" & fldF.Name & "</td>"
Next
Response.Write "</tr></thead><tbody>"
For intRec=1 To rs.PageSize
If Not rs.EOF Then
Response.Write "<tr bgcolor=""pink"">"
For Each fldF in rs.Fields
Response.Write "<td>" & fldF.Value & "</td>"
Next
Response.Write "<tr>"
rs.MoveNext
End If
Next
Response.Write "</tbody></table><p>"
response.write "<center>---------------"
for abspage = 1 to rs.PageCount