Forum Moderators: coopster
What am I doing wrong? Is there a different way to do this?
Thanks,
Kathy
behavior is the same whether I redirect using Javascript or PHP.
Are you using the same script to display the form as you are to process it?
Would you say this is your general flow:
Something you could try for debugging purposes is to set up the redirect url in a variable at the top of the script:
$url = '/page2.php';
Right after you save the data to the database,
$url .= '?save=1';
Then down where you do the redirect, use the variable:
header("Location: $url");
exit();
When the next page comes up, look in your address bar - if save=1 isn't there, you likely have a logic problem - for example, you might have the saving embedded in an if clause that isn't getting executed.
I tried your debugging idea with both the header function and location.href and the page redirects with the save=1 in the address bar. - but my data still isn't saved to the table. As I said earlier, if I comment out the redirect, my data saves to the table like it should.
Thanks for your debugging suggestion. I'll keep trying to figure this out and if you have other ideas, I would be happy to hear them.
Kathy