After a PHP_SELF Form Is Submitted, how do I redirect to a new page? [duplicate]










-1
















This question already has an answer here:



  • How do I make a redirect in PHP?

    27 answers



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.










share|improve this question













marked as duplicate by deceze html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 5:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • 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















-1
















This question already has an answer here:



  • How do I make a redirect in PHP?

    27 answers



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.










share|improve this question













marked as duplicate by deceze html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 5:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















  • 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













-1












-1








-1









This question already has an answer here:



  • How do I make a redirect in PHP?

    27 answers



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.










share|improve this question















This question already has an answer here:



  • How do I make a redirect in PHP?

    27 answers



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.





This question already has an answer here:



  • How do I make a redirect in PHP?

    27 answers







php html form-submit






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 5:06









Keith D KaiserKeith D Kaiser

3461320




3461320




marked as duplicate by deceze html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 5:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by deceze html
Users with the  html badge can single-handedly close html questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 5:54


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 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

















  • 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
















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





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 Answers
2






active

oldest

votes


















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.






share|improve this answer
































    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






    share|improve this answer





























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      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.






      share|improve this answer





























        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.






        share|improve this answer



























          1












          1








          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '18 at 5:21

























          answered Nov 15 '18 at 5:15









          PrinsPrins

          2274




          2274























              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






              share|improve this answer



























                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






                share|improve this answer

























                  0












                  0








                  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






                  share|improve this answer













                  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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 5:31









                  Jose FloridoJose Florido

                  11519




                  11519













                      這個網誌中的熱門文章

                      How to read a connectionString WITH PROVIDER in .NET Core?

                      In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                      Museum of Modern and Contemporary Art of Trento and Rovereto