Afternoon users, I have a comment function where I want to redirect users to the same page after posting a comment but the issue I am facing is that I am not able to get the value of the directed ID in the URL
Here is my code:
<?php
$ID = mysqli_real_escape_string($user, $_GET['ID']);
$tt = mysqli_real_escape_string($user, $_GET['tt']);
if(isset($_POST['submit']))
{
$name = mysqli_real_escape_string($user, $_POST['name']);
$email = mysqli_real_escape_string($user, $_POST['email']);
///------------Do Validations-------------
if(empty($name)||empty($email))
{
$errors .= "\n Name, Email are required fields. ";
}
if(IsInjected($email))
{
$errors .= "\n Bad email value!";
}
if(empty($_SESSION['6_code'] ) ||
strcasecmp($_SESSION['6_code'], $_POST['6_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= "\n The captcha code does not match!";
}
if(empty($errors))
{
//send the email
$sql="INSERT INTO user_comments
(name, email) VALUES('$name', '$email')";
$res = mysqli_query($user, $sql);
if($res) {
header("location:details.php?ID=$ID&tt=$tt");
} else {
$message = "Something went wrong. Please try again";
}
}
}
?>
When I post the submit button it gives results like http://mywebsite.com/details.php?ID=&tt=
Why not give values of ID and tt in URL? Need help plz Thanks in advance