Add the new Student number form element to the registration form.
then create a recordset that queries your table of student numbers, filter the student number column on the student number form element.
The code to insert the new rtegistration to the database looks like:
<?php
// WA Application Builder Insert
if (isset($_POST["Register_x"])) // Trigger
{
$WA_connection = $localhost;
$WA_table = "users";
$WA_sessionName = "users_UserID";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "UserEmail|UserPassword|UserVerificationCode|UserIP";
$WA_fieldValuesStr = "".((isset($_POST["UserEmail"]))?$_POST["UserEmail"]:"") ."" . "|" . "".((isset($_POST["UserPassword"]))?$_POST["UserPassword"]:"") ."" . "|" . "".$_SESSION['randomConfirm'] ."" . "|" . "".((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_localhost;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
Add an if statement around that to check if the recordset is not empty:
<?php if (!($totalRows_CheckRepeat == 0)) { ?>
< insert record code block >
<?php } ?>
If you wanted to show an error message, add the following to the page:
<?php if (($totalRows_CheckRepeat == 0) && isset($_POST["Register_x"]) { ?>
The student number you entered does not exist.
<?php } ?>