-1

I have a page that submits a form like this;

<form name="getInfoForm" class="getInfoForm" action="<?PHP echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" target="" method="post" novalidate autocomplete="off" >
<input type="submit" name="submit" value="Submit" >
</form>

After the form is processed in the PHP part of the page, how can I redirect to a new page? The PHP processes the form and submits the data to a MySQL table. I want to then go to a specific new page. How do I do that? I can't find an answer in all the similar questions, or I don't understand it.

Keith D Kaiser
  • 1,016
  • 2
  • 14
  • 31
  • I'm sorry guys, apparently I didn't explain this well enough. I understand about using HEADER but I don't know where to put it in my PHP. If I put it at the top of my code or the bottom it apparently launches immediately and takes me to the location specified. The PHP updates a MySQL table, so I need the redirect to happen after the successful INSERT INTO the table. – Keith D Kaiser Nov 15 '18 at 16:10

2 Answers2

1

You can redirect in PHP using the following:

header("location: yourpage.php")

Where "yourpage.php" is the name/path of the page you wish to redirect to.

It is worth referring to the PHP manual if you wish to learn more about the header function.

Prins
  • 1,051
  • 1
  • 6
  • 9
0

Do your redirect using header() function and also die() right after:

    header("location: xxxx");
    die();

Read more about why you need die() in this answer

Jose Florido
  • 170
  • 1
  • 10