i have grid table (example attached). user input width (column) , height (row) form. program has output price based on inputted data, if @ example, if width 800 , height 1000 price 337. ideas how approach this? i've never done before.
i know broad question .. direction or tutorial appreciated.
you need like:
// price matrix: first index y-axis, second x-axis $prices = [ 600 => [ 600 => 224, 700 => 246, 800 => 266, 900 => 291, 1000 => 313 ], // here put rest... ]; //then echo table; echo "<table><tr>"; echo "<td></td>"; // first empty cell; foreach ($prices[array_keys($prices)[0]] $y_axis => $xprices){ echo "<td>".$y_axis."</td>"; } echo "</tr>";//finish setting header foreach ($prices $y_axis => $xprices) { echo "<tr>"; echo "<td>".$y_axis."</td>"; foreach($xprices $y_axis=> $price){ echo "<td>".$price."</td>"; } echo "</tr>"; } echo "</table>";
this more orientation, in right direction.
this generates table header , first row:
<table> <tr> <td></td> <td>600</td> <td>700</td> <td>800</td> <td>900</td> <td>1000</td> </tr> <tr> <td>600</td> <td>224</td><td>246</td><td>266</td> <td>291</td><td>313</td> </tr> </table>
online php scrit: https://3v4l.org/by45n (get html fro here)
html code evaluator: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro (and put here)
Comments
Post a Comment