<form action = "settings.php" method = "post">
Student ID*:
<input type = "text" name = "std_id" value = "<?php echo $user_data['std_id'];?>"><br>
Firstname*:
<input type = "text" name = "name" value = "<?php echo $user_data['name'];?>"><br>
Surname*:
<input type = "text" name = "surname" value = "<?php echo $user_data['surname'];?>"><br>
Group*:
<select name = "group" id = "group">
<option value="0"><-- Please Select Item --></option>
<?php
$show=mysql_query("SELECT * FROM room_group_options ORDER BY op_id");
while ($array = mysql_fetch_array($show))
{
$id = $array['id'];
$group = $array['group'];
echo "<option value = '$id'> $group </option>";
}?>
</select><br>
Email*:
<input type = "text" name = "email" value = "<?php echo $user_data['email'];?>"><br>
<input type = "submit" name "update" value = "update">
</form>
This above code is update form that query from database. All variable are ok except group
if(empty($_POST) === false && empty($error) === true)
{
$update_data = array(
'std_id' => $_POST['std_id'],
'name' => $_POST['name'],
'surname' => $_POST['surname'],
'group' => (int)$_POST['group'],
'email' => $_POST['email'],
);
print_r($_POST);
print_r($update_data);
die();
}
This is use for get data from submit button. I try to use print_r to get all value in each array. They all have except group. Can I fix this issue?
Array ( [std_id] => 52211001 [name] => testname2 [surname] => testsurname1 [group] => [email] => tes21@test.com )
Array ( [std_id] => 52211001 [name] => testname2 [surname] => testsurname1 [group] => 0 [email] => tes21@test.com )
This is an output