Passing form data to thankyou page after inserting data into database in PHP

Viewed 17

I have this issue with my posting the data to another page. Here is my form:

index.php

<form action="Submit.php" method="post" enctype="multipart/form-data">
  <input type="text" placeholder="name" name="name">
  <input type="text" placeholder="phone" name="phone">
  <button type="submit" name="btn-upload">Submit</button>
</form>

Submit.php

<?php
   include_once 'connect-db.php';
      
     /*Experience List Ends*/
   if(isset($_POST['btn-upload']))
   {    
      $name=$_POST['name'];
      $phone=$_POST['phone'];
  
      $sql="INSERT INTO app_dev(name, phone) VALUES('$name','$phone')";
         mysql_query($sql);
         window.location.href = 'thankyou.php?success';
    }else
    window.location.href = 'thankyou.php?fail';
?> 

Thankyou.php

 I tried using <?php echo $_GET['name']; ?> but its not working.

It would be really appreciated if anyone please let me know how to pass value after form submit to thankyou page.

0 Answers
Related