<?php
session_start();
if (isset($_POST['submit'])){
$keyID = $_POST['inputKeyID'];
$vCode = $_POST['inputVerification'];
//...
//validate $keyID and $vCode, make sure it's all good. Set $valid_data to true if it's valid, false if not
//...
if ($valid_data) {
//data was valid, redirect to display.php
$_SESSION['keyID'] = $keyID;
$_SESSION['vCode'] = $vCode;
header('Location: display.php');
} else {
//it wasn't valid, redirect back to the form page
$_SESSION['error'] = "Your Key ID and Verification are invalid";
header('Location: index.php');
}
} else {
// no form data, redirect to index.php
$_SESSION['error'] = "Please provide Key ID and verification";
header('Location: index.php');
}
?>