954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

radio button ASP question??

Below is my source code for a questionnaire I created using HTML and ASP. It contains radio buttons for the selections. I coded it using ASP and HTML. However, when I click the submit button the selections made by user are not displayed on the screen. What am I missing?

HTML code::

<html>
<h1><STRONG><var>eLMS </var>Helpdesk</STRONG></h1>
<form>
<!--<td><STRONG>Dear<%=cookie.username%></STRONG>-->
<td><STRONG>You recently sent an email to the <var>eLMS </var>Helpdesk regarding a concern or problem you experienced with the new <var>eLMS</var> ( Learning Management System ).   Please complete this Customer Satisfaction Survey concerning the service you were provided.</STRONG>
</td></tr></form>
<!--<form method="post" action="processform.asp">  -->
<form method="post" action="C:\Documents and Settings\Administrator.ARC00WN82534000\Desktop\eLMS FORM1\eLMS feedback form\eLMS_feedback_form_process.html">
<table border="1" bgcolor="#98AFC7">
<tr>
<td align="center">
    
<blockquote>
<!--First Name: <input type="text" size="25" name="f1"> 
Last Name: <input type="text" size="25" name="f2">-->


<DIV align="center "><TABLE>

<STRONG>What was your reason for contacting the <var>eLMS</var> Help Desk? 
 </STRONG>





<input type="radio" name = "reason" value = "0"> Unable to login to eLMS
<input type="radio" name = "reason" value = "1">Unable to connect to eMLS login page
<input type="radio" name = "reason" value = "2">Password reset request
<input type="radio" name = "reason" value = "3">Unable to launch course
<input type="radio" name = "reason" value = "4">Course progress is not being saved
<input type="radio" name = "reason" value = "5">Unable to print report or completion certificate
<input type="radio" name = "reason" value = "6">Received e-mail message concerning Learning Expiration Notification
<input type="radio" name = "reason" value = "7">Other



<STRONG>How long did it take to get a response to your e-mail?</STRONG>



<input type="radio" name = "response" value = "0">Under 1 hour
<input type="radio" name = "response" value = "1">2 - 6 hours
<input type="radio" name = "response" value = "2">6 - 12 hours
<input type="radio" name = "response" value = "3">1 business day
<input type="radio" name = "response" value = "4">More than 1 business day
<input type="radio" name = "response" value = "5">They did not reply to my e-mail





<STRONG>Was your problem or issue resolved?</STRONG>



<input type="radio" name = "resolved" value = "0">Yes
<input type="radio" name = "resolved" value = "1">No







<STRONG>Overall, how would you rate your customer service experience?</STRONG>



<input type="radio" name = "rate" value = "0">Very Satisfied
<input type="radio" name = "rate" value = "1">Satisfied
<input type="radio" name = "rate" value = "2">Neutral
<input type="radio" name = "rate" value = "3">Unsatisfied
<input type="radio" name = "rate" value = "4">Extremely unsatisfied

</TABLE>


</DIV>

<STRONG>Do you have any comments or suggestions that would help us improve our eLMS customer service?   </STRONG>

<textarea name="comments" rows="5" cols="50">
</textarea>


<input type="submit" value="SUBMIT" name="action">
<input type="reset" value="RESET">
<!--<a href="C:\Documents and Settings\Administrator.ARC00WN82534000\Desktop\FAA eLMS feedback formradio.html">Feedback</a></font></p> -->
</blockquote>

end of HTML code.


ASP code::

<html>
<head>

<title>
  eLMS Feedback Form Process
</title>



<body bgcolor = "white">

<h1>
FORM OUTPUT
</h1>

<blockquote>

	<b>  Reason for contacting:</b> <%=Request.Form("reason")%> 

		<blockquote>
			<%
				theCount = Request.Form.Count
					For i = 0 to theCount
						Response.Write("<b>"& i & " - " & Request.Form(i) & "</b>")
					Next 
			%>
		</blockquote>

 	<b>  Response Time:</b> <%=Request.Form("response")%> 

		<blockquote>
			<%
				theCount = Request.Form.Count
					For i = 0 to theCount
						Response.Write("<b>"& i & " - " & Request.Form(i) & "</b>")
					Next 
			%>
		</blockquote>

	<b>  Issue Resolved:</b> <%=Request.Form("resolved")%> 

		<blockquote>
			<%
				theCount = Request.Form.Count
					For i = 0 to theCount
						Response.Write("<b>"& i & " - " & Request.Form(i) & "</b>")
					Next 
			%>
		</blockquote>


	<b>  Rate Service:</b> <%=Request.Form("rate")%> 

		<blockquote>
			<%
				theCount = Request.Form.Count
					For i = 0 to theCount
						Response.Write("<b>"& i & " - " & Request.Form(i) & "</b>")
					Next 
			%>
		</blockquote>

	

	<b>  Comments: </b>  <%=Request.Form("comments")%> 

</blockquote>


<hr>


</html>

</head>


end of ASP code::

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

You wanna use this form action

<!--<form method="post" action="processform.asp">  -->


instead of this

<form method="post" action="C:\Documents and Settings\Administrator.ARC00WN82534000\Desktop\eLMS FORM1\eLMS feedback form\eLMS_feedback_form_process.html">


I'm not sure excatly what you're trying to do, but if you want to loop through the radio buttons it should be like this:

theCount = Request.Form.Count
For i = 1 to theCount-1
Response.Write("<b>"& i & " - " & Request.Form(i) & "</b>")
Next


But itsn't want you're trying to do really smth like:
html code:

<input type="radio" name = "reason" value = "unable"> Unable to login to eLMS
<input type="radio" name = "reason" value = "Unable to connect to eMLS login page">Unable to connect to eMLS login page
<input type="radio" name = "reason" value = "Password reset request">Password reset request
<input type="radio" name = "reason" value = "Unable to launch course">Unable to launch course
<input type="radio" name = "reason" value = "Course progress is not being saved">Course progress is not being saved
<input type="radio" name = "reason" value = "Unable to print report or completion certificate">Unable to print report or completion certificate
<input type="radio" name = "reason" value = "Received e-mail message concerning Learning Expiration Notification">Received e-mail message concerning Learning Expiration Notification
<input type="radio" name = "reason" value = "Other">Other


"....and so on"


asp code:

<b>  Reason for contacting:</b> <%=Request.Form("reason")%> 
<b>  Response Time:</b> <%=Request.Form("response")%> 
<b>  Issue Resolved:</b> <%=Request.Form("resolved")%> 

"....and so on"
madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

I tried that but it still does not display the infomation selected by the user(s). I also switched it to processform.asp but still same results, No display.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

OK...check out the attached file.

I've edited it to do what I think you need it to do (?).
It works for me on IIS.

Attachments example.zip (1.69KB)
madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

I will try it and let you know what happens.

Thanks

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

So Madmittal,

When you click Submit button does the next page display the radio buttons statements that were selected and the comments that were keyed in.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

Yes.

Something like:

FORM OUTPUT Reason for contacting: Unable to launch course

Response Time: 1 business day

Issue Resolved: Yes

Rate Service: Unsatisfied

Comments: blah

You get smth else?

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Yes I am only getting the header display. No radio value buttons displayed. I am going to check and make sure my computer is running on IIS but I thought I followed the directions pretty well. Exactly what are those single quote parenthesis ( ' )on the left side of the code for?

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

Good idea...if you don't get an output like above smth is wrong.

The (') in front of a line means that the line is not executed. It's the equivilant of (//) in JavaScript....

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Well someone stated that it must run on a server. I thought I setup my desktop with IIS configurations. The steps I used to install IIS are as follows:

1. Open control panel
2. Go to add/remove programs then go to add window components
3. Highlight Internet Information Services
4. Click details then check every box in window.
5. Click next then follow instructions and insert disk of Windows XP when asked.

Is this correct or am I missing something?

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

That's correct.
When the installation is complete you should have a new directory on your hard disk where Windows is installed called 'Inetpub'.
Assuming your Windows installation hard drive is 'C:' you go to 'C:\Inetpub\wwwroot\', and place your asp files here.
Then in an Internet Explorer you type in the address 'localhost/file-name.asp' (say you want to run a file called '02.asp' type 'localhost/02.asp').

If you make a new directory in the 'Inetpub\wwwroot\' folder (say the dir is called 'tests'), they right-click the dir and choose 'Properties', go to the 'Web Sharing' tab and click 'Share this folder'. It'll prompt you for an alias, no need to change this from the dir name. Click Ok, and then you can reference the dir in Internet Explorer 'localhost/tests/file-name.asp'.

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Am I also suppose to place the html file inside the 'C:\Inetpub\wwwroot\' folder with the asp file?

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

I got it to work. thanks a lot.

What I don't understand is why can't I just click the html document link inside the wwwroot folder and it work that way. Instead I have to open internet explorer and do the local host bit.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

Great...I'm glad you got it to work (finally :p )

And yes, as you figured out for yourself, all files go in the 'wwwroot' folder.


Running your code by pointing IE to 'localhost/some-file' openes the file (of course) but also tells Windows to run it through the IIS, which in turn interprets the asp code and outputs it as html.

Double clicking the file openes IE to the address of 'C:\inetpub\wwwroot\some-file', but this way the file is processed only by IE itself....and IE doesn't understand asp, as you know.

'that make sence?

Happy huntin' :cheesy:

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Okay, I have created this survey. My next step is to create a table in MS Access that holds the records of data when user submit the survey. I created a blank table with five columns as follows: response, reason, rate, comments and resolved. Can someone point me in the direction I need to go to read and write to the table from the questionnaire that was created using ASP? Or do I have other steps I need to complete first? Any direction would be appreciated.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

You'll need a primary key in your table - a column that has unique values. A integer 'ID' column with auto incrementation will do.

To write data to your Access DB you do smth like

<%
'Dimension variables
Dim adoCon 		'Holds the Database Connection Object
Dim strSQL		'Holds the SQL query for the database


Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("database_name.mdb")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "INSERT INTO table_name VALUES('', '" & Request.Form("reason") & "', '" & Request.Form("response") & "', '" & Request.Form("resolved") & "', '" & Request.Form("rate") & "', '" & Request.Form("comments") & "');"

'the "blank" data value ( '' ) is intented for an "auto value" field like and id auto increment column.
'Using this method the number of values in the strSQL string must be the same as the number of columns in the table.

'insert new data into table
adoCon.Execute strSQL

'Reset server objects
Set adoCon = Nothing

'Redirect to some page page
Response.Redirect "thanks.htm"
%>


To get data from table

<%
'Dimension variables
Dim adoCon 		'Holds the Database Connection Object
Dim rsData		'Holds the recordset for the new record to be added to the database
Dim strSQL		'Holds the SQL query for the database


Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object
adoCon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("database_name.mdb")

'Create an ADO recordset object
Set rsData = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM table_name;"

'Open the table using the SQL query held in the strSQL varaiable
rsData.Open strSQL, adoCon

'Loop through recordset lines
Do While Not rsData.EOF
'output
Response.Write rsData("reason") & " - " & rsData("response") & " - " & rsData("resolved") & " - " & rsData("rate") & " - " & rsData("comments") & "<BR>"

rsData.MoveNext   'Move to next record
Loop

'Reset server objects
rsData.Close
Set rsData = Nothing
Set adoCon = Nothing

%>


A better database solution is mySQL, which can be installed on your pc to work with IIS.
You can download from http://www.mysql.com
You'll also need an odbc connector (also available from mysql.com). Even if you don't want to run mySQL at this point, you may still find the mySQL manual of some use since the sql syntax is the same as with Access.

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

I am suppose to use Microsoft Access for now. I think after I finish this project I will be using Oracle database not sure.
What does this statment mean?

PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE.

I tried to find it in my ASP book but no luck. Also, does VB script use semi-colons because there are a couple of lines of code that have them and I did not think VBScript and ASP used semicolons.

Appreciate the comments in the code helps out alot for some of the parts that I can understand.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

The statement tells the asp interpreter which database is being used and where to find the database file.

it could also look like:
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database_name.mdb")

You're right; vbscript doesn't use semicolons. But the semicolons are only in the SQL strings, so actually they're not part of the vbscript but interpretet only by the database connector.

As far as I remeber the semicolon isn't even mandatory in connecting to Access DB's.....but I'm not sure (I always use mySQL). Anyway it's a habit for me to put them in 'cause when working with the mySQL "interfase" they are in fact mandatory.

madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Okay. Lets take this step by step to make sure I am doing this right. This is all a learning experiment project for me. It has no time committments. So I am given a piece of paper,and asked to create this questionnaire so that feedback will be received and evaluated by management team.

First step: Create the questionnaire in html.
Second step: Write the code in ASP to get information back from client.
Third Step: Create a table in Access to capture the feedback sent back from the client. This table consists of six columns which include the names( reason,response,rate,resolved and comments), and primary key. Fourth: Write the code in ASP to read and write information from questionnaire to the table.
Fifth: Task Complete.


Does this sound like the steps needed to complete this task.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

Question: The database name for the statement below would that be Microsoft Access, the file name of the table or something else? Or is it the name you give when you set up the DSN?

Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("database_name.mdb")

Question: How do you know which method to use or have to use between OLE DB or ODBC to connect to a database?

Question: When I try to create the DSN, when I decide to Windows NT authentication or SQL server, either way I receive an error connection failed, any ideas why? I am using Windows XP professional.

djbsabkcb
Junior Poster in Training
92 posts since Jun 2005
Reputation Points: 14
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You