I am adding a custom validation page to a WordPress Website I am working on.
Here is how the steps work to get a better understanding of the functional need.
The issue.
I have built all my forms and everything is working except the validation process. Here is the script I am using
<?php
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['int_no']) || empty($_POST['firstnames']) || empty($_POST['surname'])) {
$error = "It appears that you have forgotten to fill out one of the form fields. Please fill out all requested information and try again.";
}
else
{
// Define $int_no $firstnames and $surname
$int_no=$_POST['int_no'];
$firstnames=$_POST['firstnames'];
$surname=$_POST['surname'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$connection = mysql_connect("localhost", "username", "password");
// To protect MySQL injection for Security purpose
$int_no = stripslashes($int_no);
$firstnames = stripslashes($firstnames);
$surname = stripslashes($surname);
$int_no = mysql_real_escape_string($int_no);
$firstnames = mysql_real_escape_string($firstnames);
$surname = mysql_real_escape_string($surname);
// Selecting Database
$db = mysql_select_db("IUEC-MEMBERS", $connection);
// SQL query to fetch information of registered Union Members and finds if there is a match.
$query = mysql_query("select * from login where surname='$surname' AND firstnames='$firstnames' AND int_no='$int_no'", $connection);
$rows = mysql_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$int_no; // Initializing Session
header("location: http://iuec50.info/preview/online-membership-registration/"); // Redirecting To Other Page
} else {
$error = "We were not able to verify the information you provided. Please ensure you are entering your information as it appears on your International Card. If you continue to have issues please contact your Local.";
}
mysql_close($connection); // Closing Connection
}
}
?>
I am getting an error when I enter the information and select the submit button.
The website URL in question is http://iuec50.info/preview/member-sign-up/
I am turing to the gurus that are within this site in hopes that you can shine some light on this issue.
Thank you all for your assistance.