#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

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


    hi everyone my promblem is that i apply loop on one row of table ,the exceution of loop depends on the user input in the text mean whatever the number user write in the textbox repective number of rows will be display.Now each row contain textbox,comboxbox on selcting value from combobox n entering value in textbox from first three column ,result will display.how can i pass these selected value n result on next page for further computation plz help me in ths
    javascripting code

    <script>
    function getText3(row){
    var in1=document.getElementById('in1-' + row).value;
    var in2=document.getElementById('in2-' + row).value;
    var in4=document.getElementById('in4-' + row).value;
    var in3=(in1*in2*in4*30)/1000;
    document.getElementById('in3-' + row).value=in3.toFixed(2 );

    }
    </script>
    table coding

    <table border="1" align="center" id="wr123">
    <tr>
    <th>WAS</th>
    <th>NO.</th>
    <th>AVERAGE</th>
    <th>APPROX</th>
    </tr>
    <?php

    for ($i = 1; $i <= $de; $i++) {
    ?>
    <tr>
    <td>Tube</td>
    <td>
    <select id="in4-<?php echo $i; ?>" name="t1" onclick="getText3(<?php echo $i; ?>)" >
    <option value="0">0</option>
    <option value="12">12</option>
    <option value="18">18</option>
    <option value="24">24</option>
    <option value="75">75</option>
    </select>
    </td>
    <td>
    <input type="text" name="t2" id="in1-<?php echo $i; ?>" onblur="getText3(<?php echo $i; ?>)" />
    </td>
    <td>
    <select name="a1" id="in2-<?php echo $i; ?>" onclick="getText3(<?php echo $i; ?>)" >
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    </td>
    <td>
    <input type="text" id="in3-<?php echo $i; ?>" name="username" readonly="readonly" />
    </td>
    <td>
    </tr>

    <?php } ?>
    </table>
    </body>
    </html>
    plz help me thanks in advance as i new in php
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by aniya123
    hi everyone my promblem is that i apply loop on one row of table ,the exceution of loop depends on the user input in the text mean whatever the number user write in the textbox repective number of rows will be display.Now each row contain textbox,comboxbox on selcting value from combobox n entering value in textbox from first three column ,result will display.how can i pass these selected value n result on next page for further computation plz help me in ths
    javascripting code

    <script>
    function getText3(row){
    var in1=document.getElementById('in1-' + row).value;
    var in2=document.getElementById('in2-' + row).value;
    var in4=document.getElementById('in4-' + row).value;
    var in3=(in1*in2*in4*30)/1000;
    document.getElementById('in3-' + row).value=in3.toFixed(2 );

    }
    </script>
    table coding

    <table border="1" align="center" id="wr123">
    <tr>
    <th>WAS</th>
    <th>NO.</th>
    <th>AVERAGE</th>
    <th>APPROX</th>
    </tr>
    <?php

    for ($i = 1; $i <= $de; $i++) {
    ?>
    <tr>
    <td>Tube</td>
    <td>
    <select id="in4-<?php echo $i; ?>" name="t1" onclick="getText3(<?php echo $i; ?>)" >
    <option value="0">0</option>
    <option value="12">12</option>
    <option value="18">18</option>
    <option value="24">24</option>
    <option value="75">75</option>
    </select>
    </td>
    <td>
    <input type="text" name="t2" id="in1-<?php echo $i; ?>" onblur="getText3(<?php echo $i; ?>)" />
    </td>
    <td>
    <select name="a1" id="in2-<?php echo $i; ?>" onclick="getText3(<?php echo $i; ?>)" >
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    </td>
    <td>
    <input type="text" id="in3-<?php echo $i; ?>" name="username" readonly="readonly" />
    </td>
    <td>
    </tr>

    <?php } ?>
    </table>
    </body>
    </html>
    plz help me thanks in advance as i new in php
    plz rply me
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    29
    Rep Power
    0
    Originally Posted by aniya123
    plz rply me
    Can you break this down into a very small example which does not include all this code?

    If the problem is passing valuse from one page to another, then maybe use the $_SESSION variables, or use the $_POST variables with ajax perhaps?

    What we really need to help you is a small very quick example of your problem rather than the whole code. This way if you understand the principle then you can apply it anywhere.

    Also, I have found that someone will normally come along on the forum and look for unanswered posts like I have, but if you add to the thread yourself, then the thread has 1 post and we all think it has been answered and dont look at it. A lot of questions can be answered in 1 or 2 post replies.
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,867
    Rep Power
    6351
    Please read the new user guide to find out how to debug your own problems, post questions which will get responses, and follow the forum rules (which you've already broken with your bump)
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo