php
Document Expires After Redirect If Form Did Not Validate
Looking for some advice on this problem. I happened to run into using the php framework Yii, but seems more a universal issue with web forms/my lack of understanding this concept. Issue: When pressing the back button on the browser, user gets "Document Expired" only if the form had a validation error. If there was no validation error before it was submitted, there is no "Document Expired" problem (because of the redirect). Take this simple generic example of a controller: public function actionSomething() { $model=new ExampleClass; if(isset($_POST['ExampleClass'])) { $model->attributes=$_POST['ExampleClass']; if($model->validate()) { $this->redirect(Yii::app()->createUrl('some/where')); } } $this->render('_form',array( 'model'=>$model )); } So when validation fails, the form is sitting there with $_POST data. Then, data is submitted again, validation passes and the redirect happens. Next, when the back button is pressed on the browser, it runs into the form in the state prior to passing validation and I get the "Document Expired" problem. How can I prevent this?
I'm not totally sure how far or what you're willing to try - I might suggest using sessions to store variables. Doing this will allow you to recall the values of the variables during a page refresh. http://us2.php.net/manual/en/session.examples.basic.php Here's a better link for a usage demo: http://www.w3schools.com/php/php_sessions.asp
Related Links
Display posts on homepage - Custom PHP CMS
How to get specific substring digit from string using php? [duplicate]
How to get featured image from post
How to catch 401 response in Laravel/Lumen?
Remove the top level array and merge sub array into one
PHP GET Variable [duplicate]
JQuery AJAX is encoding API Token for Laravel Application, results in 401 Unauthorized
ShareThis webservice on Drupal 7 site has stopped working (images not appearing)
Wecoomerce custom query to filter products loop
Unable to get PhpMailer working with Office 365
How to link php mvc page through href
database connected but not responding as expected when queried
Concat comma separated firstname and lastname using mysql
Using Instagram api without authentication
Android Studio simple notification using json/php
Mysql add 1 day to timestamp