开发者

Php page refresh , get the post values from formm

i got a jquery upload and crop script and i am trying to use it.

First i have a 1.html file which has a form, which requires some texts and image. After submitting the form it goes to main.php where it checks for some image properties and if successful it refreshes the page using header("location:".$_SERVER["PHP_SELF"]);

So if i place my 开发者_Python百科$_POST['name'] i get the value from 1.html . Now when the image in displayed after page refresh there is one more option to select the thumbnail and upon selecting the thumbnail there is one more page refresh, to display the final images (both bigger and thumb). Now my problem is for second page refresh i am not able to get the fields which i had posted from 1.html. Any suggestion would be highly appreciated. Thanks


With that header refresh you are losing every information. Drop the refresh and do consecutive forms: you need to propagate the values you need from the first form, using hidden input fields in the forms that follow

<input type="hidden" value="<?php echo $value_from_original_post; ?>">

or you can store the value(s) of interests in session variable(s).

Alternatively, you can use an AJAX solution which requires no reload or page change, but it's a bit more work (and you might not want javascript).


You can not store states between pages unless:

  • Keep rolling the value(s) forward as hidden input type if it's a form submission.
  • Temporarily save value(s) as cookie until consumed.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜