Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: how to display information....


Message #1 by DEREK TRAN <derekhtran@y...> on Sat, 20 Oct 2001 19:45:55 -0700 (PDT)
Hi,

Does anyone know how to display the values of Total in

the appropriate places (at the end of the row Total)? 

Also, if the user clicks on the button Total, then the

values should popup along with the result 

that the user has enter, another words is, it should

show the value for "Do you like apple?" either 

"yes" or "no", and so on. If the user clicks on the

submit button, then the information will be submit 

to the database (This part is not important at this

moment). 

Thanks, 

Derek. 

PS. Below is the code and the URL 



http://www24.brinkster.com/derektran/count.asp 



<form name="Testing" method="post" action="count.asp">



<table width="63%" border="1"> 

<tr> 

<td width="80%">&nbsp;</td> 

<td width="9%">Yes</td> 

<td width="9%">No</td> 

</tr> 

<tr> 

<td colspan="3"><b><font

size="+1">Personal</font></b></td> 

</tr> 

<tr> 

<td width="80%">1.Do you like apple?</td> 

<td width="8%"> 

<input type="radio" name="apple" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="apple" value="n"> 

</td> 

</tr> 

<p> 

<tr> 

<td width="80%">2.Do you go to school?</td> 

<td width="8%"> 

<input type="radio" name="school" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="school" value="n"> 

</td> 

</tr> 

<tr> 

<td width="80%">3.Are you under 18 of age?</td> 

<td width="8%"> 

<input type="radio" name="age" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="age" value="n"> 

</td> 

</tr> 

<tr> 

<td width="80%">4.Are you living in USA?</td> 

<td width="8%"> 

<input type="radio" name="living" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="living" value="n"> 

</td> 

</tr> 

<tr> 

<td colspan="3">&nbsp;</td> 

</tr> 

<tr> 

<td colspan="3"><font size="+1"><b>Other

Considerations. </b></font></td> 

</tr> 

<tr> 

<td width="80%">1. Do you have health insurance?</td> 

<td width="8%"> 

<input type="radio" name="insurance" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="insurance" value="n"> 

</td> 

</tr> 

<tr> 

<td width="80%">2. Do you eat three times per

day?</td> 

<td width="8%"> 

<input type="radio" name="eat" value="y"> 

</td> 

<td width="12%"> 

<input type="radio" name="eat" value="n"> 

</td> 

</tr> 

<tr> 

<td colspan="3">&nbsp;</td> 

</tr> 

<tr> 

<td colspan="1"><input type="submit" value="Total">

</td> 

<td width="2">&nbsp;</td> 

<td width="3">&nbsp;</td> 

</tr> 

<tr> 

<td colspan="3">The total has to add up to 6, that is

#yes + #no = 6</td> 

</tr> 

<tr> 

<td colspan="3"><b>Note: <font color="#FF0000">This

information is just 

for testing the website. 

</font></b></td> 

</tr> 

<tr> 

<td colspan="3"><input type="submit" value="Submit">

</td> 

</tr> 

</table> 

</form> 



<% 

dim ncount,ycount 

ncount = 0 

ycount = 0 

For Each Item in Request.Form 

If Request.Form(Item) = "n" Then 

ncount = ncount + 1 

End If 

Next 



For Each Item in Request.Form 

If Request.Form(Item) = "y" Then 

ycount = ycount + 1 

End If 

Next 



response.write ycount 

response.write "<BR>" 

response.write ncount 

%>





Message #2 by Greg Griffiths <griffiths@x...> on Sun, 21 Oct 2001 18:37:28 +0100
Derek,

         Your best bet for this is Javascript, as it can do and does all of 

this for many people. If you need some examples let me know.



At 19:45 20/10/01 -0700, you wrote:

>Hi,

>Does anyone know how to display the values of Total in

>the appropriate places (at the end of the row Total)?

>Also, if the user clicks on the button Total, then the

>values should popup along with the result

>that the user has enter, another words is, it should

>show the value for "Do you like apple?" either

>"yes" or "no", and so on. If the user clicks on the

>submit button, then the information will be submit

>to the database (This part is not important at this

>moment).

>Thanks,

>Derek.

>PS. Below is the code and the URL

>

>http://www24.brinkster.com/derektran/count.asp

>

><form name="Testing" method="post" action="count.asp">

>

><table width="63%" border="1">

><tr>

><td width="80%">&nbsp;</td>

><td width="9%">Yes</td>

><td width="9%">No</td>

></tr>

><tr>

><td colspan="3"><b><font

>size="+1">Personal</font></b></td>

></tr>

><tr>

><td width="80%">1.Do you like apple?</td>

><td width="8%">

><input type="radio" name="apple" value="y">

></td>

><td width="12%">

><input type="radio" name="apple" value="n">

></td>

></tr>

><p>

><tr>

><td width="80%">2.Do you go to school?</td>

><td width="8%">

><input type="radio" name="school" value="y">

></td>

><td width="12%">

><input type="radio" name="school" value="n">

></td>

></tr>

><tr>

><td width="80%">3.Are you under 18 of age?</td>

><td width="8%">

><input type="radio" name="age" value="y">

></td>

><td width="12%">

><input type="radio" name="age" value="n">

></td>

></tr>

><tr>

><td width="80%">4.Are you living in USA?</td>

><td width="8%">

><input type="radio" name="living" value="y">

></td>

><td width="12%">

><input type="radio" name="living" value="n">

></td>

></tr>

><tr>

><td colspan="3">&nbsp;</td>

></tr>

><tr>

><td colspan="3"><font size="+1"><b>Other

>Considerations. </b></font></td>

></tr>

><tr>

><td width="80%">1. Do you have health insurance?</td>

><td width="8%">

><input type="radio" name="insurance" value="y">

></td>

><td width="12%">

><input type="radio" name="insurance" value="n">

></td>

></tr>

><tr>

><td width="80%">2. Do you eat three times per

>day?</td>

><td width="8%">

><input type="radio" name="eat" value="y">

></td>

><td width="12%">

><input type="radio" name="eat" value="n">

></td>

></tr>

><tr>

><td colspan="3">&nbsp;</td>

></tr>

><tr>

><td colspan="1"><input type="submit" value="Total">

></td>

><td width="2">&nbsp;</td>

><td width="3">&nbsp;</td>

></tr>

><tr>

><td colspan="3">The total has to add up to 6, that is

>#yes + #no = 6</td>

></tr>

><tr>

><td colspan="3"><b>Note: <font color="#FF0000">This

>information is just

>for testing the website.

></font></b></td>

></tr>

><tr>

><td colspan="3"><input type="submit" value="Submit">

></td>

></tr>

></table>

></form>

>

><%

>dim ncount,ycount

>ncount = 0

>ycount = 0

>For Each Item in Request.Form

>If Request.Form(Item) = "n" Then

>ncount = ncount + 1

>End If

>Next

>

>For Each Item in Request.Form

>If Request.Form(Item) = "y" Then

>ycount = ycount + 1

>End If

>Next

>

>response.write ycount

>response.write "<BR>"

>response.write ncount

>%>

>

>

>








Message #3 by DEREK TRAN <derekhtran@y...> on Sun, 21 Oct 2001 20:32:26 -0700 (PDT)
Hi Greg,

Yes, would you please send me some links or examples

for this problem?



Thanks,

dinh


  Return to Index