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">
         while ($row = mysqli_fetch_assoc($result)) {

  echo '
              <th width=70% colspan="3"> '.$row[project_name].'</th>
                     <td class="alt" ><b>Contract Name</b></td>
                                <td class="alt"> '.$row[project_name].'</td>
                     <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 class="alt" ><b>Bonus</b></td>
                                <td class="alt">
<input type="text" name="bonus" size=10  id="bonus"  >
                                      <td width=200 class="alt"></td>



   <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>

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

Recommended Answers

All 2 Replies

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).

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].'">

and at another page

$bonus = count($_POST['bonus']) ? $_POST['bonus'] : array();
$base_pay = count($_POST['base_pay']) ? $_POST['base_pay'] : array();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.