Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

make a select , then pass data to next pa ge

How can I write php program to take data form row that customer select
The below is my code please look at
www.kohsamui.ca/computer/install.html 




<?
for ($times=2;$times<=10;$times++) {
 $ProCost = 18000;
 $paid = 3000;
 $IntRate = 1.5;
 $InsCost = $ProCost-$paid;
 $interrest = $InsCost*$IntRate/100*$times;
 $total = $interrest+$InsCost;
 $monthPay = $total/$times;

//  <td>&nbsp;</td>
?>

 <tr align="right">
  <td><?php echo number_format($ProCost,2); ?></td>
  <td><?php echo number_format($paid,2); ?></td>
  <td><?php echo number_format($IntRate,2); ?></td>
  <td><?php echo $times; ?></td>
  <td><?php echo number_format($InsCost,2); ?></td>
  <td><?php echo number_format($interrest,2); ?></td>
  <td><?php echo number_format($total,2); ?></td>
  <td><?php echo number_format($monthPay,2); ?></td>
 </tr>

<?php
}
?>

</table>
SOLUTION
Avatar of Kani Str
Kani Str
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
************ Correction  *********** missed to place the values inside "" for the value attribute...
<tr align="right">
  <td><?php echo number_format($ProCost,2); ?> <input name="procost<?php echo $times?>" value="<?php echo number_format($ProCost,2); ?>">  </td>

// other values here.........

 </tr>

Ref : http://www.kohsamui.ca/computer/install.html

Name the check boxes as I have done above, i.e generae dynamic name for check boxes.
<input type="checkbox" name="checkbox<?php echo $times?>" >

Once the user selects the options and submit, you can find the slected options from their name and select the values from the hidden boxes of the corresponding row set.

For example
if checkbox2 is checked select values from the  procost2 , paid2 ...etc
if checkbox3 is checked select values from the  procost3 , paid3 ...etc



Hope this helps.


ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just stick that stuff into a PHP file by itself and put it on your webserver and it should work fine. I tested it.
JP