hi. ...I have an html form where i am trying to pass the value of a select option to $_POST for use in another php file...the field of interest in the form is pre-populated with a selected option. However, the form is passing the same selected value, regardless of whether i select a different option. pls show error of my ways
here is the form code:
<form action="edit_product.php" method="post"
id="edit_product_form">
<label>Category:</label>
<select name="category_id">
<?php foreach ($categories as $category) : ?>
<option value="<?php $category['categoryID']; ?>"
<?php if ($category['categoryID'] == $category_id) echo " selected" ?>>
<?php echo $category['categoryName']; ?>
</option>
<?php endforeach; ?>
</select>
</form>
no matter what i select from the drop-down, what is passing appears to be the initial value of the selected option (value="<?php $category['categoryID']; ?>")..what am i missing to allow me to pass the newly selected option? thanks!!!!!
pass html form select value to php $_POST - pls help!!!
Moderator: General Moderators
Re: pass html form select value to php $_POST - pls help!!!
Actually it will be passing the right value. I suspect the place where you try to get or use that is where the problem is.