如何在php中提交表单后获取用户名? [重复]

This question already has an answer here:

if (isset($_POST['submit'])) {
    $name=$_POST['name'];
    $email=$_POST['email'];
    $enquiry=$_POST['enquiry'];
    $message=$_POST['message'];
    $insert = "insert into contact(name, email, nature, message)
    values('$name', '$email', '$enquiry', '$message')";
    if(mysqli_query($conn, $insert)) {
        header('location: contactus.php');
    }
}

I want to show popup box on the contact us page with the name($name) of the user who has submitted his/her details in contact form...!

</div>

try header('location: contactus.php?success&name=$name'); and on contactus.php

if(isset($_GET['success']))
  {
     $name=$_GET['name'];
 echo"<script>window.alert("'.$name.'");</script>";
 }