kimstar00
10-20-2006, 09:42 PM
I'm new ASP and i'm having trouble with linking two asps. :confused:
I have a search page, from this search page i click on a radio button and type the data that i'm looking for in, once i submit this entry i want to make it so that if for example "orders by customer number" was selected and i type something other than the customer number it gives me an error saying that the value is wrong/the value isnt numeric. I've tried doing this but it doesnt work. I dont kno why.
asp file 1 (search.asp)
<%@ Language="VBScript" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Search Page</title>
<meta name="description" content="Search Page"/>
<link href="Assign2.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<form id="search" action="process.asp?open=1" method="post">
<h1>Search Page</h1>
<table border="1">
<tr>
<td><input type="radio" name="searchoption" id="bylastname" value="1"/> Orders by Customer Last Name<br/></td>
<td><input type="radio" name="searchoption" id="bycustomerno" value="2"/>Orders by Customer Number<br/></td>
<td><input type="radio" name="searchoption" id="bydate" value="3"/> Orders by Date<br/></td>
<td><input type="radio" name="searchoption" id="byorderno" value="4"/> Orders by Order Number<br/></td>
</tr>
</table>
<input type="text" name="searchfld" size="121"/><br/>
<hr>
<input type="radio" name="searchoption" id="byshipping" value="5"/> Shipped (no input required)<br/>
<input type="submit" value="Search"/><input type="reset" value="Reset"/>
</form>
</body>
</html>
asp file 2 (process.asp)
<html>
<body>
searched = request.form("searchfld")
selected = request.form("searchoption")
<%
if selected = 2 then
number = request.form("searchfld")
' check what was entered before processing
if IsNumeric(searchfld) then
number = int(searchfld)
if number < 100000 or number > 999999 then
response.write("The data was not in the required range")
end if
else
response.write("Data entered was not numeric")
end if
%>
</body>
</html>
I have a search page, from this search page i click on a radio button and type the data that i'm looking for in, once i submit this entry i want to make it so that if for example "orders by customer number" was selected and i type something other than the customer number it gives me an error saying that the value is wrong/the value isnt numeric. I've tried doing this but it doesnt work. I dont kno why.
asp file 1 (search.asp)
<%@ Language="VBScript" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Search Page</title>
<meta name="description" content="Search Page"/>
<link href="Assign2.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<form id="search" action="process.asp?open=1" method="post">
<h1>Search Page</h1>
<table border="1">
<tr>
<td><input type="radio" name="searchoption" id="bylastname" value="1"/> Orders by Customer Last Name<br/></td>
<td><input type="radio" name="searchoption" id="bycustomerno" value="2"/>Orders by Customer Number<br/></td>
<td><input type="radio" name="searchoption" id="bydate" value="3"/> Orders by Date<br/></td>
<td><input type="radio" name="searchoption" id="byorderno" value="4"/> Orders by Order Number<br/></td>
</tr>
</table>
<input type="text" name="searchfld" size="121"/><br/>
<hr>
<input type="radio" name="searchoption" id="byshipping" value="5"/> Shipped (no input required)<br/>
<input type="submit" value="Search"/><input type="reset" value="Reset"/>
</form>
</body>
</html>
asp file 2 (process.asp)
<html>
<body>
searched = request.form("searchfld")
selected = request.form("searchoption")
<%
if selected = 2 then
number = request.form("searchfld")
' check what was entered before processing
if IsNumeric(searchfld) then
number = int(searchfld)
if number < 100000 or number > 999999 then
response.write("The data was not in the required range")
end if
else
response.write("Data entered was not numeric")
end if
%>
</body>
</html>