Jump to content

Dynamic Form To Database


Guest beginner

Recommended Posts

Guest beginner

I am so confused. I had created a dynamic form that was pulling survey questions from the database based on the user's district name and survey type. It was displaying the questions just fine, but then I began messing around with the page to try to figure out how to process the form once submitted to input the answers back into the database. Not only have I failed to figure out how to do this but now my questions are not displaying anymore. I have looked over the code more times than I care to think about and cannot figure out what went wrong. Please help. Thanks in advance.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><%Option Explicit%><% 		if session("User_ID") = ""  then 		response.Redirect("/login.asp")		end if%><%Dim district, survey_type, submitdistrict = session("District_Name")survey_type = Request.querystring("survey_type")Dim Rs, sSQL, connection, sConnStringset connection = Server.CreateObject("ADODB.Connection")sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("/access_db/database.mdb") connection.Open(sConnString)Set Rs = Server.CreateObject("ADODB.Recordset")  'Initialise the sSQL variable with an SQL statement to query the databasesSQL = "SELECT * FROM ItemPool WHERE ( district='" & district & "' And survey_type='" & survey_type & "')"Rs.open sSQL, connection, 3, 3%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/home.dwt" codeOutsideHTMLIsLocked="false" --><!-- DW6 --><head><!-- Copyright 2005 Macromedia, Inc. All rights reserved. --><title>General</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link rel="stylesheet" href="../styles/general.css" type="text/css" /><script type="text/javascript" src="../Templates/js/dropdowntabs.js">/************************************************ Drop Down Tabs Menu- © Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit Dynamic Drive at [url="http://www.dynamicdrive.com/"]http://www.dynamicdrive.com/[/url] for full source code***********************************************/</script><!-- CSS for Drop Down Tabs Menu #1 --><link rel="stylesheet" type="text/css" href="../Templates/styles/glowtabs.css" /><style type="text/css"><!--.style2 {	color: #33CC33;}--></style></head><body bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">  <tr bgcolor="#FFFFFF">    <td height="50" colspan="2" valign="bottom" align="center" bgcolor="#FFFFFF"><img src="../images/header.jpg" alt="" name="header" width="950" height="50" id="header" /><em>      <hr class="style2" />    </em></td> </tr>  <tr>    <td colspan="2" bgcolor="#ffffff">	<div id="glowtab" class="glowingtabs"><ul><li><a href="http://www.veamos.org/index.asp" title="Home"><span>Home</span></a></li><li><a href="http://www.veamos.org/about.asp" title="About"><span>About</span></a></li><li><a href="http://www.veamos.org" title="Survey Tools" rel="dropmenu1_a"><span>Survey Tools</span></a></li><li><a href="http://www.veamos.org/index.asp" title="Students"><span>Students</span></a></li><li><a href="http://www.veamos.org/simpleblog3/projects.asp" title="Projects"><span>Projects</span></a></li><li><a href="http://www.veamos.org/contact.asp" title="Contact"><span>Contact</span></a></li></ul></div><div class="glowtabsline"> </div><!--1st drop down menu --><div id="dropmenu1_a" class="dropmenudiv_d"><a href="http://www.veamos.org/sgc.asp">School Guidance and Counseling</a><a href="http://www.veamos.org/CTE.asp">Career and Technical Education</a><a href="http://www.veamos.org/Edsvys.asp">Educator Surveys</a><a href="http://www.veamos.org/Accred.asp">School Accreditation</a><a href="http://www.veamos.org/CES.asp">Classified Evaluation System</a></div><script type="text/javascript">//SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])tabdropdown.init("glowtab", "auto")</script></td>  </tr>    <tr bgcolor="#99CC66">  <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"></td>  </tr> <tr>    <td colspan="2" bgcolor="#ffffff"></td>  </tr> <tr>    <td width="3%"> <br />     <br /></td>    <td width="97%"><table border="0" cellspacing="0" cellpadding="2" width="97%">	 <!-- InstanceBeginEditable name="EditPageName" -->      <tr>        <td class="pageName">ITEM POOL </td>      </tr>	 <!-- InstanceEndEditable -->       <tr>        <td class="bodyText">		 <!-- InstanceBeginEditable name="EditContent" -->		 <form id="itempool" name="itempool" method="post" action="process.asp"> 		 <table width="100%" border="0">          <%If Rs.EOF Then 	Response.Write "No records found" Else 	Do while not Rs.EOF 			%>		   <tr>             <td><input name="<%=Rs.fields("ID")%>" type="radio" value="1" />               <input name="<%=Rs.fields("ID")%>" type="radio" value="2" />               <input name="<%=Rs.fields("ID")%>" type="radio" value="0" checked="checked" />			    <% Response.Write Rs("question") %>  <% Response.Write Rs("standard") %></td>           </tr>		   	<%			Rs.MoveNext			Loop			End if			%> 			<tr>             <td><input name="submit" type="submit" value="Next Page" /></td>           </tr>		</table>		 </form><%Rs.CloseSet Rs = Nothingconnection.CloseSet connection = Nothing%><!-- InstanceEndEditable --></td>	 </tr>   </table>   </td> </tr></table></body><!-- InstanceEnd --></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...