我想从表单发布一个php变量

编程入门 行业动态 更新时间:2024-10-26 18:21:48
本文介绍了我想从表单发布一个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变量

本文发布于:2023-10-12 01:13:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483341.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我想   表单   变量   php

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!