473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

how to pass value of different rows from a loop to next page in php

7
hi everyone my problem is this that i dynamically creted rows of table on the basis user input. Now each row contain textbox,comboxbox on selcting value from combobox n entering value in textbox from first three column ,result will display.on passing these selected n entered value on next page only the last row values moves to next page .i want to pass all loop values to next page
Expand|Select|Wrap|Line Numbers
  1. javascripting code
  2. <script>
  3.  function getText3(row){
  4.             var in1=document.getElementById('in1-' + row).value;
  5.             var in2=document.getElementById('in2-' + row).value;
  6.             var in4=document.getElementById('in4-' + row).value;
  7.             var in3=(in1*in2*in4*30)/1000;
  8.             document.getElementById('in3-' + row).value=in3.toFixed(2 );
  9.  
  10.     }
  11.  
  12. </script>
  13. </head>
  14. table code 
  15. <?php
  16. $de=$_POST['text123'];
  17. echo $de;
  18. ?>
  19.  
  20. <body>
  21. <form action="kl2.php" method="post" >
  22.        <table border="1" align="center" id="wr123">
  23.     <tr>
  24.         <th>WAS</th>
  25.         <th>NO.</th>
  26.         <th>AVERAGE</th>
  27.         <th>APPROX</th>
  28.     </tr>
  29.     <?php
  30.  
  31.     for ($i = 1; $i <= $de; $i++) {
  32.     ?>
  33.     <tr>
  34.         <td>Tube</td>
  35.         <td>
  36.             <select id="in4-<?php echo $i; ?>" name="t1" onclick="getText3(<?php echo $i; ?>)" >
  37.                 <option value="0">0</option>
  38.                 <option value="12">12</option>
  39.                 <option value="18">18</option>
  40.                 <option value="24">24</option>
  41.                 <option value="75">75</option>
  42.             </select>
  43.         </td>
  44.         <td>
  45.             <input type="text" name="t2" id="in1-<?php echo $i; ?>" onblur="getText3(<?php echo $i; ?>)" />
  46.         </td>
  47.         <td>
  48.             <select name="a1" id="in2-<?php echo $i; ?>" onclick="getText3(<?php echo $i; ?>)" >
  49.                 <option value="0">0</option>
  50.                 <option value="1">1</option>
  51.                 <option value="2">2</option>
  52.                 <option value="3">3</option>
  53.                 <option value="4">4</option>
  54.                 <option value="5">5</option>
  55.                 <option value="6">6</option>
  56.                 <option value="7">7</option>
  57.                 <option value="8">8</option>
  58.             </select>
  59.         </td>
  60.         <td>
  61.             <input type="text" id="in3-<?php echo $i; ?>" name="username" readonly="readonly" />
  62.         </td>
  63.         <td>
  64.     </tr>
  65.     <?php } ?>
  66.     <input type="submit" name="submit" />
  67.  
  68.     </table>
  69.     </form>
  70.     kl2.php
  71. <?php
  72. @$a=$_POST['t1'];
  73. echo @$a;
  74. $sl = $_POST['t2'];
  75. echo $sl;
  76. $b=$_POST['a1'];
  77. echo $b;
  78. $c=$_POST['username'];
  79. echo $c;
  80.  
  81.  
  82. ?>
on submit click it only display the last row values i.e if user enter 3 ,3 rows get displayed after clicking the submit only the data of last row display
May 25 '13 #1
1 2746
Rabbit
12,516 Expert Mod 8TB
That's because all your form fields have the same name.
May 25 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: weiwei | last post by:
Hi all I am having trouble, let's say, I have a form text field, and I want to pass it to the next page, however, I don not want to use submitted button, instead I want to have a variable in link...
3
by: eddie wang | last post by:
I have one asp page with javascript to begin. In the Javascript, I have drop down list value. How can I passdrop value to asp page easily? For example, if the user selects the value, the asp...
1
by: empiresolutions | last post by:
Hello Fellow Programmers, I have an issue with a very large PHP page that calls over 20 different MySql Statements. This page is loading somewhat slow and i want to speed things up. I have looked...
0
by: mailsazmat | last post by:
Hi, Can any one help me out in this regard. I want to pass the data in the rows of the first column in the grid view to the next page in c#. i am able to pass the columns heading using the...
1
by: Camstar | last post by:
I have a simple asp page which displays a query when you enter parameters and clikc on a "search" button. The problem is that if i use a checkbox as part of the query, when i click on "search", the...
4
by: CGatto | last post by:
Hello, Just wondering if anyone has ever managed to find a way to have a datagridviewimagecolumn display different images on different rows depending on some data element in the row. Our...
2
by: digituf | last post by:
i have 2 forms here. 1) DisplayDetails.php 2) RegistrationForm.php when user click to the link 'Next' at the DisplayDetails.php page it will bring all the session value to the...
0
by: jitsbytes | last post by:
Hi, I am using Struts (1.2) framework. I am using Display Tag of struts. My problem is as below: I have a page where I am displaying three tables using "display:table" tag of struts, the values...
5
by: dave816 | last post by:
Sorry for the Excel question in an Access forum...................I don't see an Excel forum and there's probably a reason for that but figured I'd give this a shot anyway. Again sorry, delete if...
2
tharini
by: tharini | last post by:
I want to pass two values to the next page using javascript function xmlhttp.open() function. Could u please tell me the correct syntax? xmlhttp.open("GET","getuser.php?q="+str,true); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.