Send value with form to other document PHP HTML

Wednesday, November 4, 2015

I'm trying to make a form that will display a product, that will allow me to type in a number of how many i want to buy, and then a submit button that sends tvs and tvno to another document. The first option with the SELECT is working, but the 2nd(my desired display of the "shop") doesnt.



<!--FORM NR 1-->

<form action="http://localhost/wordpress/restock/myDbMod/" method="post">
<table>
<caption>Sales</caption>
<tr>
<td><select name='tvs'>
<?php
foreach ($tvs as $tv) {
printf("<option value='%s'>%s inch, in stock: %s</option>\n"
, $tv->getScreenSize()
, $tv->getScreenSize()
, $tv->getStockLevel());
}
?>
</select></td>
<td><input type='text' name='tvno'/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Send"/></td>
</tr>
</table>
</form>


<!--FORM NR 2-->

<form action="http://localhost/wordpress/restock/myDbMod/" method="post">
<table>
<?php
foreach ($tvs as $tv) {
printf("<tr><td name='tvs' value='%s'>%s inch, in stock: %s</td><td><input type='text' name='tvno'/></td>\n"
, $tv->getScreenSize()
, $tv->getScreenSize()
, $tv->getStockLevel());
}
?>
<td><input type="submit" value="Send"/></td></tr>
</table>
</form>

0 comments:

Post a Comment