我有这个 html 代码:
<select id="users_list" data-placeholder="Choose a user..." multiple name="users_list[]">
<?php while($users = mysql_fetch_array($all_users)){ ?>
<option value='<?php echo serialize(array($users['id_user'], $users['name'], $users['image_url'])); ?>' <?php if($users['id_user'] == $_SESSION['user_id']) echo "disabled"; ?>><?php echo $users['name']; ?></option>
<?php } ?>
</select>
如何将值插入 mysql db?为了清楚,我写了这个 php 代码:
$users_list = $_POST['users_list'];
foreach($users_list as $user)
{
$user = unserialize($user);
foreach($user as $info){
}
$query = "INSERT INTO messages (from_user, to_user, text, sender_name, sender_image, recipant_name, recipant_image, date) VALUES ('$uid', '$user', '$message', '$uname', '$uimage', '$time')";
$insert = mysql_query($query);
$mid = mysql_insert_id();
update_user_notf($user, $uid, $uname, $uimage, $mid, "message");
}
那是不对的,我需要另一个php代码来执行此操作。请帮忙。