By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

Inserting multiple selection into a database

P: 2
I have a code that populates a select field with options and I need to insert into a database the value of the options rather than the id of the field.
How can I accomplish this?

Code:
<?php

$sql = "SELECT id, secure FROM secure";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
While ($row = mysql_fetch_assoc($result)) {
$sclist[$row['id']] = $row['secure'];
}
}

?>

<?php

<select multiple='multiple' name="secure[]" size="10">
<?php
foreach ($sclist as $key => $value) {
echo "<option value='$key' " . $secure[$key] .
">$value</option>\n";
}
?>
</select>

?>

Thank you anyone.
Apr 30 '07 #1
Share this Question
Share on Google+
1 Reply


P: 2
Already solved.
May 1 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.