I want to redirect my validation messages on different pages but it just redirects to the success page but the database remains unchanged. The else conditions are the problem
<?php
if(isset($_POST['submit']))
{
$fullname=$_POST['fullname'];
$age=$_POST['age'];
$email=$_POST['email'];
$dbc=mysqli_connect('localhost','root','root','wordpress');
if(!empty($fullname) && !empty($age) && !empty($email))
{
$query="SELECT * FROM wp_mypage WHERE email='$email' ";
$result=mysqli_query($dbc,$query);
$data=mysqli_fetch_arrray($result);
if(mysqli_num_rows($data)==0)
{
$query="INSERT INTO wp_mypage (name,age,email) VALUES ('$fullname','$age','$email') ";
mysqli_query($dbc,$query);
header("Location: http://localhost/wordpress/?page_id=67");
}
else
{
***header("Location: http://localhost/wordpress/?page_id=73");***
}
}
else
{
***header("Location: http://localhost/wordpress/?page_id=73");***
}
mysqli_close($dbc);
}
?>
Aucun commentaire:
Enregistrer un commentaire