I have a select that is dynamically created.
<select name="approve-<?php echo $leadID; ?>" id="<?php echo $leadID; ?>" class="approve">
<option value="1">Yes</option>
<option value="2">No</option>
</select>
it is inside a php loop that retrieves records from a db. and a form that sends its content via $.post to a php file. for some reason even if I change the value of a SELECT, I receive back from the PHP file all 3 values the same. Any ideas?
JS:
var post = $('#开发者_如何学编程approveLead').serialize();
$.post("db/approveleads.php", post, function(data) {
alert(data);
return false;
});
PHP:
echo '<br/>'.$_POST['approve-1'];
echo '<br/>'.$_POST['approve-2'];
echo '<br/>'.$_POST['approve-3'];
As far I can understand your $leadID
returns 1,2,3.... etc.... If this is true you may find the following helpful....
<select name="approve-<?php echo $leadID; ?>" id="id_<?php echo $leadID; ?>" class="approve">
精彩评论