<% 'first see if this is being used to edit a recipe 'the modify process is roundabout here, 'first the user goes to a search page, then 'gets a results page then comes back to this add page 'all in order to modify. Add and modify use the same form if request.querystring("function")="edit" then DIM CONN2 DIM RS2 DIM SQL2 Set Conn2=server.createObject("ADODB.Connection") Conn2.open "DSN=nothingtoit_7051" SQL2 = "SELECT * FROM recipe_tbl WHERE entry_id = " & request.querystring("id") & ";" set RS2=server.createobject("ADODB.Recordset") RS2.open SQL2, CONN2 'Now start the preloaded form %> Update recipe:
Name: ">
Keywords: ">
Category:
Description:
Ingredients:
Directions:
Vegetarian?: <% if rs2("boolean_field") <> TRUE then %> <% else %> <% end if %>
Start Date: ">
  ">
<% else if request.querystring("action") = "new" then %>

Enter a new recipe:

Name:
Keywords:
Category:
Description:
Ingredients:
Directions:
Vegetarian?:
Start Date:
 
<% else if request.form("vegetarian")= "true" then vegetarian = true else vegetarian = false end if set conn=server.createObject("ADODB.connection") conn.open "DSN=nothingtoit_7051" SQL = "INSERT INTO recipe_tbl (keywords, intro, directions, ingredients, category, boolean_field, rotw, name) Values ('" SQL = SQL & cleanstring(request.form("keywords")) & "', '" & CleanString(request.form("description")) & "', '" & cleanstring(request.form("directions")) & "', '" & cleanstring(request.form("ingredients")) & "', '" & cleanstring(request.form("category")) & "', " & vegetarian & ", " & "'"& request.form("rotw") &"'" & ", '" & cleanstring(request.form("name")) & "');" set CmdObj=server.createObject("ADODB.command") set CMDOBJ.ActiveConnection = CONN CMDOBJ.commandtext = SQL CMDOBJ.commandtype = adcmdtext cmdobj.execute 'response.write SQL & "
" response.write "Done. Add another recipe." 'response.write "
" & Live end if end if Function CleanString(sqlValue) CleanString = replace(sqlValue, "'", "''") End function %>