<%
on error resume next
'Variables assigned on start of document
'all leading and trailing blanks are removed
'and any single quotes are changed to '
u_action=request.querystring("u_action")
u_title=replace(trim(request.form("u_title")),"'","'")
u_description=replace(trim(request.form("u_description")),"'","'")
u_directions=replace(trim(request.form("u_directions")),"'","'")
u_rateplan=replace(trim(request.form("u_rateplan")),"'","'")
u_facilities=replace(trim(request.form("u_facilities")),"'","'")
u_wateractivities=replace(trim(request.form("u_wateractivities")),"'","'")
u_other=replace(trim(request.form("u_other")),"'","'")
u_plant=replace(trim(request.form("u_plant")),"'","'")
u_visiting=replace(trim(request.form("u_visiting")),"'","'")
u_animals=replace(trim(request.form("u_animals")),"'","'")
u_log=request.querystring("u_log")
script_name=request.servervariables("script_name")
%>
<%
'Check to see if the user is adding an article
'if so, then display the input form
if u_action <> "add" then
'if the user is not looking for the input field
'then they will be interacting with the db
'in one of three ways.
'1. to insert a new article
'2. to view a specific observation
'3. to display recent headlines
'The following select statement will adjust the
'sql according to which action is requested
select case u_action
case "display"
sql="select * from homestaylist where log = "&u_log
case else
sql="select * from homestaylist order by title asc "
end select
accessdb="db/homestay"
cn="driver={Microsoft Access Driver (*.mdb)};"
cn=cn & "dbq=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, cn
'if there are no observations found then
'redirect the user to the default view
'except if the user is adding an article
if u_action <> "insert" then
if rs.eof then
response.redirect script_name
end if
end if
'Start html output
%>
<% 'Display successful addition of article to db
if u_action="insert" then %>
Your Article was added.
<% else 'Display db output %> <% do while not rs.eof and counter < 1000 ' Change 1000 to any number of Titles you want to display counter=counter+1 %> <% if u_action <> "display" then %> "><%= rs("title") %>
<% else %> <%= rs("title") %>
"><--Back <% end if rs.movenext loop end if end if %>
<% else 'Display db output %> <% do while not rs.eof and counter < 1000 ' Change 1000 to any number of Titles you want to display counter=counter+1 %> <% if u_action <> "display" then %> "><%= rs("title") %>
<% else %> <%= rs("title") %>
Overview
<%= rs("description") %>Directions
<%= rs("directions") %>Rate Plan
<%= rs("rateplan") %>Facilities
<%= rs("facilities") %>Activities
| Water activities | Other |
|---|---|
| <%= rs("wateractivities") %> | <%= rs("other") %> |
Environments
| Plant | Animals |
|---|---|
| <%= rs("plant") %> | <%= rs("animals") %> |
Visiting Places
<% =rs("visiting") %>"><--Back <% end if rs.movenext loop end if end if %>