Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2005, 03:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default loop values and text box values move

How can move values recieve by loop and input values to
next page ?


<form method=post action="http://localhost/tabulation/mhours/mhconfirmadd.asp?userid=<%= Response.Write(userid) %>" id=myform

name=myform onSubmit="return docheck()">




ssql="select projno from project"
set rs=cn.Execute(ssql)

%>

    <h1 align="center">&nbsp; </h1>
      <blockquote>
        <blockquote>
          <div align="left"></div>
        </BLOCKQUOTE>
      </BLOCKQUOTE>
     <P align=center>

      <table width="80%" border="1" bordercolor="#black" cellspacing="0" cellpadding="0">
        <%do while rs.eof=false%>
        <tr>
          <td colspan="3"><div align="left"><strong><%Response.Write(rs("projno") )%></strong></div></td>
          <td width="11%"> <div align="center">

            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh1 name=mh1 style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh2 name=mh2 style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh3 name=mh3 style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh4 name=mh4 style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>



        </tr>

        <%
        rs.movenext
        loop
        %>

      </table>
      <br>
      <input type=submit value="Save" id=submit name="submit">
     </form>

-----------------------
next page asp file


userid=Request.QueryString("userid")

projno=Request.Form("projno")
mh1=Response.Write("mh1")
mh2=Response.Write("mh2")
mh3=Response.Write("mh3")
mh4=Response.Write("mh4")


Response.Write(userid)
Response.Write(projno)
Response.Write(mh1)
Response.Write(mh2)
Response.Write(mh3)
Response.Write(mh4)

------------------
ie.
project no value display by the loop
and againt of each projectno user enter
the MH1, MH2, MH3, MH4 values in input box


project no.....MH1......MH2....MH3....MH4
------------------------------------------
2016.........10......20......10......25
3210.........10......20......10......25
2002.........10......20......10......25
...
..

above values to move next page how ?

each projectno have separate values.
Please help to correct the code.

regards.

Mateen




 
Old March 30th, 2005, 10:47 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, Mateen,
You should dynamically change the input file name like:
<%loopIndex = -1
  do while rs.eof=false
  loopIndex = loopIndex + 1
%>
<td width="11%"> <div align="center">
 <INPUT id=mh1<%=loopIndex %> name=mh1<%=loopIndex %> style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh2<%=loopIndex %> name=mh2<%=loopIndex %> style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>

            <td width="11%"> <div align="center">
              <INPUT id=mh3<%=loopIndex %> name=mh3<%=loopIndex %> style="WIDTH: 83px; HEIGHT: 22px" size=10>
            </div></td>
 <%
        rs.movenext
        loop
  %>
 to make sure each <input> field has unique name.
 your projectNo cann't be passed to the next page. if you want it to be passed, you should put them in <input> tag

 In the next asp page:
 if the projectNo cann't be empty, you can loop the table rows like:

 <%for index = 0 to MAXAVAILABLENUMBER
     if request.form("projectNo" & index) <> "" then
        projno = request.form("projectNo" & index)
        mh1=request.form("mh1" & index )
        mh2=request.form("mh2" & index )
        mh3=request.form("mh3" & index )
        mh4=request.form("mh4" & index )
        'THEN DISPLAY THEM
     else
        exit for
     end if
 Next%>

 I didn't test it, but the idea is like this.

 Andraw




 
Old April 5th, 2005, 11:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your response.

each projectno received separate values to next page ?

ie.

projno=2010
mh1=10
mh2=25
mh3=35
mh4=15

projno=2016
mh1=25
mh2=45
mh3=39
mh4=38
..
.

I am trying.

regards.

Mateen







Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Text box values are different shoakat Classic ASP Databases 2 April 28th, 2005 12:29 AM
How to get values of a text box from one page to NitinJoshi General .NET 3 January 6th, 2005 06:30 AM
putting the values in the text box shoakat Classic ASP Databases 5 October 14th, 2004 02:37 PM
Getting text box values between forms? cdnamm BOOK: Professional C#, 2nd and 3rd Editions 1 August 13th, 2003 11:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.