如何将选中的复选框值发送到php中的另一个页面 [英] how to send selected checkbox value to another page in php

查看:112
本文介绍了如何将选中的复选框值发送到php中的另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有复选框数组,如果勾选复选框,则应在另一页上显示特定复选框值的详细信息。我尝试了会话变量,但它只需要一次值。如果我返回并检查不同的复选框,则会显示较旧的值。我也使用了未设置($ _ session ['value'])...有没有其他方法可以完成此任务?

I have check box array,if I check the check box the details of specific check box value should be displayed on another page. I tried with session variables but it will take value only once. If I go back and check the different check box , the older value is displayed..I also used unset($_session['value'])...Is there any other way to accomplish this task?

推荐答案

_session ['value'])...有没有其他方法可以完成这项任务?
_session['value'])...Is there any other way to accomplish this task?


有两种方法可以传输数据不依赖于会话变量的常用的一页到另一页。



AJAX和< form>



HTML

表单有另一个页面作为目标(或链到一个),并且可以从目标页面检索值(每个复选框需要一个名称='')。我更喜欢
There are two ways to transmit data from one page to another that are commonly used that don't rely on session variables.

AJAX and <form>

HTML
The form has another page as a target (or chains to one) and the values can be retrieved (each checkbox needs a name='') from the target page. I prefer


_REQUEST ['名称']。返回上一页(即带有表单的页面)通常会清除所有数据。如果您再次提交,它将使用当前数据而不存储以前的数据。



从本地javaScript执行AJAX,并在执行send过程时传递变量。与表单不同,它不会导致您加载新页面,而是可以更新当前页面。虽然不完全是你想要做的,但它可以进行调整,可以让你更好地思考你的解决方案



所有这一切都可以通过这里[^]



_REQUEST['the name']. Going back to the previous page (i.e., the one with the form) typically clears all data. If you submit it again it will use the current data with no memory of the previous data.

AJAX is executed from a local javaScript and you pass the variables when you execute the send procedure. Unlike the form, it doesn't cause your to load a new page but rather can update your current page. Although not exactly what you want to do, it can be adapted and may give you a better way of thinking about your solution

All of this can be studied via HERE [^]


这篇关于如何将选中的复选框值发送到php中的另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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