I am writing an inventory Management system. I am mostly complete with it. It is pretty basic, but does the job.
So now I am working on the look of it. I placed a Searchbox/Query inside a div at the top of the page. The Search works. But it only displays the result on the page that is listed.
What I want to do is have the Search redirect to this page when the button is Submitted, but It is not working. So I am wondering where to put the header("Location: loggedin.php");
I have gotten this to work in different parts of the Site, but for some reason it is not working here.
<?php
session_start();
if( isset( $_POST['Search'] ) ) {
// build a function to validate data
function validateFormData( $formData ) {
$formData = trim( stripslashes( htmlspecialchars( $formData ) ) );
return $formData;
}
$formEmail = validateFormData( $_POST['email'] );
include('connection.php');
$query = "SELECT first_name, last_name, email, card_number, pc_type
FROM
profiles WHERE email ='$formEmail'";
$result = mysqli_query( $conn, $query );
if( $formEmail == $email ) {
session_start();
$_SESSION['email'] = $email;
header("Location: profilepage2.php");
}
}
mysqli_close($conn);
?>
I do not think the HTML should matter in this case, but if I am wrong I will post it in an edit.