Solved

Html table formating in ASP  HELP!

Posted on 2000-03-04
5
203 Views
Last Modified: 2012-06-27
My first project in ASP and definately in the dark. Designing a site for our insurance agency. Wanting to do a small amount of basic rating there. From the first page "numberof.asp" we will use 2 combo boxes "cboDrivers" and "cboVehicles" to collect the quantity of each. Upon submit we would like the receiving page "info.asp" to show sets of form question fields for each number of drivers and vehicles choosen from the first page. I am no sure of the difficulty of all of this so if more points are worthy just LMK.
0
Comment
Question by:colonelmustard
5 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2583205
in numberof.asp page you can do this.
<FORM action="info.asp" method="post">
<SELECT id=select1 name="cboDrivers">
<option>1</option>
<option>2</option>
</select>
<SELECT id=select1 name="cboVehicles">
<option>1</option>
<option>2</option>
</select>
<input type=submit name="Send Info">
</FORM>
on the info.asp page
request the sended values
<%
drivers= request.form("cboDrivers")
vehicles = request.form("cboVehicles")
%>

I don't know if thats what you wanted though.
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 2583606
Continuing from Marine...

Once ou have drivers and vehicles, you can do this:

<%
For CurDrive = 1 to Drivers
  Response.write "Driver " & CurDriver
    ' Rest of fields...
Next

For CurVehicle = 1 to Vehicles
    Response.write "Vehicle " & CurDriver
    ' Rest of fields...
Next
%>
0
 
LVL 27

Expert Comment

by:BigRat
ID: 2583800
Colonel Mustard of Cluedo fame?

I'm sure there must be more than that on the first page. But Marine's answer is perfectly correct.
0
 
LVL 3

Accepted Solution

by:
rmullins earned 100 total points
ID: 2639130
I have modified Maries post and added a bunch of info to help you see a bit more.
I also over-commented this so you can understand it better.

Try this:
---------------- BEGIN NumberOf.asp ---------------
<HTML><BODY>
<FORM action="info.asp" method="post">
<%'Select number of drivers%>
  Number of Drivers
    <SELECT name="cboDrivers">
      <option>1</option>
      <option>2</option>
    </select>
<%'New line and a blank line%>
  <br><br>
<%'Select number of vehicles%>
  Number of Vehicles
    <SELECT name="cboVehicles">
      <option>1</option>
      <option>2</option>
    </SELECT>
<%'New line and a blank line%>
  <br><br>
<%'Display button causing info to be sent to info.asp%>
  <INPUT type="submit" name="Continue">
</FORM>
</BODY></HTML>
---------------- END NumberOf.asp ---------------

---------------- BEGIN Info.asp ---------------
<%@ Language="VBScript"%>
<%OPTION EXPLICIT%>
<%
'Declare Variables
    Dim intDrivers
    Dim intVehicles
    Dim i
'Get number of drivers and vehicles
      intDrivers = CInt(Request.Form("cboDrivers"))
      intVehicles = CInt(Request.Form("cboVehicles"))
%>
<HTML><BODY>
You selected <%=intDrivers%> driver and <%=intVehicles%> vehicles.<br><br>
<FORM action="step3.asp" method="post">
<hr>
<b><u>Drivers:</b></u><br>
<%'Display the driver info boxes%>
 <TABLE align="center">
      <%For i = 1 to intDrivers%>
            <tr><td colspan="2"><b><u>Driver #<%=i%>:</u></b></td></tr>
            <tr><td>Name:</td>
                  <td><INPUT type="text" name="txtName"></td></tr>
            <tr><td>Age:</td>
                  <td><INPUT type="text" name="txtAge"></td></tr>
            <tr><td colspan="2">&nbsp;</td></tr>
      <%Next%>
 </TABLE><br><hr>
<b><u>Vehicles:</b></u><br>
<%'Display the vehicle info boxes%>
 <TABLE align="center">
      <%For i = 1 to intVehicles%>
            <tr><td colspan="2"><b><u>Vehicle #<%=i%>:</u></b></td></tr>
            <tr><td>Year:</td>
                  <td><INPUT type="text" name="txtYear"></td></tr>
            <tr><td>Make:</td>
                  <td><INPUT type="text" name="txtMake"></td></tr>
            <tr><td>Model:</td>
                  <td><INPUT type="text" name="txtModel"></td></tr>
            <tr><td colspan="2">&nbsp;</td></tr>
      <%Next%>
 </TABLE><hr>
</FORM>
</BODY></HTML>
---------------- END NumberOf.asp ---------------

That completely answers your question and ought to get you going. Good luck.
-- Rob --
0
 
LVL 3

Expert Comment

by:rmullins
ID: 2639133
Ick, sorry about the formatting being so bad. I didn't 'respace' info.asp in InterDev (tested it) before I dropped it in here.

Pull it into your editor and you can quickly reformat it to enhance readability.

-- Rob --
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question