All,
I’ve got a form in which I’d like for viewer to be able to complete and then update them all at once. One of the form elements is a menu drop down, which complicates things. Here is how I’m trying to do it:
[code]
if ($_POST[‘save’] == “Save Position Changes”) {
$checked= $_POST[‘order’];
foreach ($checked as $action) {
update(“update articles set order = $action where id = ‘$action'”);
}
}
<select name=”order[]”>
<option value=”1″ <?php if (!(strcmp(1, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>1</option>
<option value=”2″ <?php if (!(strcmp(2, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>2</option>
<option value=”3″ <?php if (!(strcmp(3, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>3</option>
<option value=”4″ <?php if (!(strcmp(4, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>4</option>
<option value=”5″ <?php if (!(strcmp(5, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>5</option>
<option value=”6″ <?php if (!(strcmp(6, $results[‘order’]))) {echo “selected=”selected””;} ?> id=”<?php echo $results[‘id’]; ?>”>6</option>
</select>
How can I pass both the value of the drop down and the id of the record?