Question about $_GET
Posted: Mon May 05, 2008 10:33 pm
Hi everyone,
I'm new here, I hope I'm posting this in the right place.
I'm making a Facebook application in PHP, and since I've never really coded much in PHP, I'm just building my experience now, I've run into a bit of a problem.
For a Facebook app, when someone just adds it you can link the user to a specific url, mine would be apps.facebook.com/(MYAPP)/index.php?status=new
My index.php file checks to see if status is set, and if it equals "new", then it displays a slightly different page. More importantly, it initializes some stuff for the user in my MySQL database. Basically it adds the user to the database and sets a bunch of other fields equal to 0. Now my problem is that the rest of my app works using $_POST, so if the user does some stuff, and the index.php page reloads with a bunch of POST information, the URL is still index.php?status=new and it tries to add the user to the database again. This time it throws an error, cause the entry already exists...
My question then, is this: once the user has been added to the database, so basically everything in ?status=new, how can I make it that if the page reloads again that the URL won't be ?status=new anymore? I'm also worried about what would happen if the user clicked back on their browser, because that would still be there...
Are there any ways of doing this without making it so that when a user adds the application it goes to a completely different URL that doesn't use $_POST?
Thanks!
I'm new here, I hope I'm posting this in the right place.
I'm making a Facebook application in PHP, and since I've never really coded much in PHP, I'm just building my experience now, I've run into a bit of a problem.
For a Facebook app, when someone just adds it you can link the user to a specific url, mine would be apps.facebook.com/(MYAPP)/index.php?status=new
My index.php file checks to see if status is set, and if it equals "new", then it displays a slightly different page. More importantly, it initializes some stuff for the user in my MySQL database. Basically it adds the user to the database and sets a bunch of other fields equal to 0. Now my problem is that the rest of my app works using $_POST, so if the user does some stuff, and the index.php page reloads with a bunch of POST information, the URL is still index.php?status=new and it tries to add the user to the database again. This time it throws an error, cause the entry already exists...
My question then, is this: once the user has been added to the database, so basically everything in ?status=new, how can I make it that if the page reloads again that the URL won't be ?status=new anymore? I'm also worried about what would happen if the user clicked back on their browser, because that would still be there...
Are there any ways of doing this without making it so that when a user adds the application it goes to a completely different URL that doesn't use $_POST?
Thanks!