0

Hi all,
im sorry, im just a beginner, I had never come across to such circumstances.
Submit a form, with while loop, how am i going to retreive every single value submitted from the form?

<form name="pay"  action="pay.php" method="post">
  
        <?php
         while ($row = mysqli_fetch_assoc($result)) {

  echo '
  
              <th width=70% colspan="3"> '.$row[project_name].'</th>
                  <tr>
                     <td class="alt" ><b>Contract Name</b></td>
                                <td class="alt"> '.$row[project_name].'</td>
                </tr>
                  <tr>
                     <td class="alt" ><b> Pay</b></td>
                                <td class="alt">
<input type="text" name="base_pay" id="base_pay" size=10  value= "'.$row[base_pay].'">
</td>
                                   
                </tr>
                     <tr>
                     <td class="alt" ><b>Bonus</b></td>
                                <td class="alt">
<input type="text" name="bonus" size=10  id="bonus"  >
</td>
                                      <td width=200 class="alt"></td>
                </tr>
<tr>


';

         }

        ?>
   <tr><td class="alt" >
<input type="button" VALUE="Back" onClick="window.location.href='view_pay.php'"/>
    <input type="submit" id="submit"  value="Compute"/></td></tr>
      </form>

can someone guide me,please. How to retreive all the value after submit
Thank you!

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by qwertpink
0

Use $_POST to get the values submitted in the form (use for each field name and replace the word fieldname with your actual field names).

0

I solved it.
I cant use $_POST because there's while loop so there's multiple base pay and multiple bonus.
so my forms have to include

<td class="alt" ><b>Base Pay</b></td>
                                <td class="alt">
<input type="text" name="base_pay[]" id="base_pay" size=10  value= "'.$row[base_pay].'">
</td>

and at another page

$bonus = count($_POST['bonus']) ? $_POST['bonus'] : array();
$base_pay = count($_POST['base_pay']) ? $_POST['base_pay'] : array();
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.