0
if (isset($_POST['dept']) && isset($_POST['batch']) && isset($_POST['Month']) && isset($_POST['Year']) && isset($_POST['semester'])) // based on these values selected from database
{
$dept = $_POST['dept'];
$batch = $_POST['batch'];
$month = $_POST['Month'];
$year = $_POST['Year'];
$semester = $_POST['semester'];
$query = db_select('student_master');
$query->fields('student_master', array('reg_no','name','dob','dept_code','degree','batch_year'));
$query->condition('dept_code',$dept,'=') AND $query->condition('batch_year',$batch,'=');
$results = $query->execute();
echo "<table>";
echo "<tr>";
echo "<td><label for='reg_no'> Registration Number </label></td>";
echo "<td>";
echo "<select name='reg_no'>";
foreach($results as $student_result)
{
echo "<option value ='$student_result->reg_no'> $student_result->reg_no</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";
$query = db_select('subject');
$query->fields('subject', array('subject_name','credits','subject_code'));
$query->condition('dept_code',$dept,'=') AND $query->condition('semester_appear',$semester,'=') ;
$subject_results = $query->execute();
echo "<tr>";
echo "<td><label for='Subject'>Subject Name</label></td>";
echo "<td>";
echo "<select name = 'sub_name' id = 'sub_name'>";
foreach($subject_results as $subjects_result)
{
echo "<option value ='$subjects_result->subject_code'> $subjects_result->subject_name</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td><label for='Subject'>Subject Serial Number</label></td>";
echo "<td>";
echo "<select name='subject_serial' id = 'sub_name'>";
if ($semester == "SEMESTER-I")
{
for($i=101; $i<=110; $i++)
{
echo "<option value ='$i'>$i</option>";
}
}
elseif ($semester == "SEMESTER-II")
{
for($i=201; $i<=210; $i++)
{
echo "<option value ='$i'>$i</option>";
}
}
elseif ($semester == "SEMESTER-III")
{
for($i=301; $i<=310; $i++)
{
echo "<option value ='$i'>$i</option>";
}
}
elseif ($semester == "SEMESTER-IV")
{
for($i=401; $i<=410; $i++)
{
echo "<option value ='$i'>$i</option>";
}
}
echo "</select>" ;
echo "</td>";
echo "</tr>";
echo "</table>";
}
else
{
return "please check the your input";
}
使用PHP或JavaScript和存儲選擇的值中選擇的盒如何增加選擇框字段添加按鈕之後動態地添加選擇框字段(所選擇的框包含從DATAS數據庫點擊添加按鈕後,並在數據庫中同一選擇的值存儲)通過使用PHP或JavaScript和存儲選擇的值在選擇框中數據庫如何點擊點擊添加按鈕後動態通過在數據庫