This topic is locked

redirect page and alerts

9/1/2017 2:47:32 AM
PHPRunner General questions
ffrinai author

hi,

i'd like to redirect to another page after record added with a condition.

I try with this code in ater record added:
echo "<script>alert('ATTENTION1: Value of apridistinta is : ".$_REQUEST["apridistinta"] ."')</script>";

if ($_REQUEST["apridistinta"]=='S') {

if (!$inline){

if (STRVAL($values['veas1'])<>0){

echo "<script>alert('ATTENTION2: Redirect ')</script>";

header("Location: distinte_edit.php?editid1=" . $iddistinta);

exit();

};

};

};
when the value of $_REQUEST["apridistinta"] is <> 'S' the alert ATTENTION1 is displayed.

when the value of $_REQUEST["apridistinta"] is == 'S' no alert is displayed!!!! but only open the redirected page.

In my progect i need some alerts before redirect to the other page.

Any solutions?

Thanks

Admin 9/1/2017

You cannot show message and do redirect after that, redirect is the only command you can run.
You can save your message to some session variable and then display it on the page you are redirecting to.