【发布时间】:2013-04-13 15:13:22
【问题描述】:
我有以下 php 代码。如何修改复选框以在我的数据库中保留作为“勾号”的选定值,然后再次打印回来?
<?php
if ( isset($_GET['success']) === true && empty($_GET['success'])===true ){
echo'Updated Sucessfuly!';?>
<?php
}else{
if( empty($_POST) === false && empty($errors) === true ){
$update_data_profile_career = array(
'Consulting' => $_POST['Consulting'],
'user_id' => $session_user_id,
);
update_user_profile_career($session_user_id, $update_data_profile_career);
header('Location: profile_update_career_goal.php?success');
exit();
}else if ( empty($errors) === false ){
echo output_errors($errors);
echo'</br></br>';
}
?>
<input type="checkbox" name="Consulting[]" value="<?php echo $user_data_profile_career['Consulting']; ?>" />Consulting
【问题讨论】:
-
您要根据数据库返回值选择
checkbox? -
我想在表单中选中它,然后下次我再次打开表单时看到它被选中
-
你为什么使用输入数组?您是否有超过 1 个咨询复选框?