我知道...還有就是做這個邏輯比我到目前爲止已經試過一個最好的辦法???創建邏輯在最佳途徑
這是我的代碼...
//------------ Check code search bar form submission ---------------//
if (isset($_POST['code_search_submitted'])) {
if (isset($_POST['searchCode']) && !empty($_POST['searchText'])) {
if (is_numeric($_POST['searchText']) && (strlen($_POST['searchText']) == 4)) {
$searchCode = $_POST['searchCode'];
if ($searchCode == 1) {
$_SESSION['searchCode'] = 'TutorCode';
} elseif ($searchCode == 2) {
$_SESSION['searchCode'] = 'InstituteCode';
}
$_SESSION['searchText'] = $_POST['searchText'];
} else {
$searchingError= 'Ennter four digits for code!';
echo '<script type="text/javascript">';
echo "alert('" . $searchingError . "')";
echo "</script>";
}
$url = BASE_URL . 'search/searching.php'; // Define the URL:
ob_end_clean(); // Delete the buffer.
header("Location: $url");
exit(); // Quit the script.
} else {
$searchingError= 'Enter Tutor or Institute Code!';
echo '<script type="text/javascript">';
echo "alert('" . $searchingError . "')";
echo "</script>";
}
} //---- Check code search bar form submission ----//
任何意見是極大的讚賞...
謝謝...
首先,你應該正確地縮進代碼 – dynamic
難從這段代碼說。如果沒有'ob_start' –