I got help writing php to add an extra row of input fields when the user clicks a button:
<?php
$rowsx=1;
if(isset($_POST[“rowsx”])){
$rowsx=$
}
for($e=1;$e<=$rowsx;$e++){
?>
<td><tr>
<div align=”center”>Quantity –
<input name=”product_options_amount<?php echo $e ?>” type=”text” id=”product_options_amount” value=”<?php echo($_POST[“product_options_amount”.$e]);?>” style=”text-align:center” size=”3″ />
</div></td>
<td>
<div align=”center”>Color –
<select name=”product_options_color<?php echo $e ?>” id=”product_options_color” >
<option value=”White”<?php if(isset($_POST[“product_options_color”.$e]===”white”){echo ” selected”;}}?>>White</option>
<option value=”Black”<?php if(isset($_POST[“product_options_color”.$e]===”black”){echo ” selected”;}}?>>
Black
<option value=”Red”<?php if(isset($
</div></td>
</tr>
<?php
}
?>
<input type=”hidden” name=”rowsx” value=”<?php echo $rowsx+1; ?>” />
<input name=”submit” type=”submit” value=”Add another row” />
It works great, but I need one more thing. When the user adds another line, I need it to create a textbox for each line added. This textbox will be in another form. I think you’d put the php in the second form and use the variable $e, but I’m not sure how. Thanks.