刷新页面而不会丢失Post值 [英] Refresh page without losing the Post value

查看:183
本文介绍了刷新页面而不会丢失Post值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刷新页面时如何保持$ post值;换句话说,如何刷新页面而又不会丢失Post值

How do I maintain the $post value when a page is refreshed; In other words how do I refresh the page without losing the Post value

推荐答案

如果没有页面提交,这是不可能的!除非您以某种方式将表单字段提交回服务器,即在没有使用jQuery等的页面刷新的情况下进行某种形式的自动保存表单脚本.

This in not possible without a page submit in the first place! Unless you somehow submitted the form fields back to the server i.e. Without Page Refresh using jQuery etc. Somesort of Auto Save Form script.

如果这是用于验证检查,则不需要按照建议进行会话.

If this is for validation checks no need for sessions as suggested.

用户填写表格并提交回自我 服务器端验证失败

User fills in the form and submits back to self Sever side validation fails

$ _ GET

    <input type="hidden" name="first" 
   value="<?php echo htmlspecialchars($first, ENT_QUOTES); ?>" />

验证消息,结束.

或者按照建议将整个帖子保存在一个会话中,类似这样,但是必须再次提交才能上班....

alternatively as suggested save the whole post in a session, something like this, but again has to be first submitted to work....

$ _ POST

if(isset($_POST) & count($_POST)) { $_SESSION['post'] = $_POST; }
if(isset($_SESSION['post']) && count($_SESSION['post'])) { $_POST = $_SESSION['post']; }

这篇关于刷新页面而不会丢失Post值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆