我想从表单发布一个php变量 [英] I want to post a php variable from a form

查看:69
本文介绍了我想从表单发布一个php变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个php变量"echo $ id".现在,我想使用$ _POST方法发布变量.我只想知道如何对变量执行此操作,因为$ _POST [$ id]不起作用?

I have a php variable "echo $id". Now I want to use the $_POST method to post the variable. I just want to know how to do this for a variable because $_POST[$id] does not work?

推荐答案

使用$ _POST方法,您必须将其发布到某个东西.

With the method $_POST you must be posting to something.

我对您的建议是创建一个表单,然后将该表单转到您要发布到的文件:

My suggestion to you is to create a form, then have the form going to the file you wish to post to:

是这样的:

echo '<form action  = "fileToPostTo.php" method = "post">
<input type = "text" hidden value = "'.$id.'" />
</form>';

然后在通过jquery或javascript加载文档时提交表单.

And then submit the form when the document loads through jquery or javascript.

这篇关于我想从表单发布一个php变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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