On my page.
i have one textbox and one button.
-- on the button click event.
-- one function will be called.
Now,
How to get that value of textbox and store in php variable? this should be done in that function which we will call on button click.
如何在php中获取文本框值?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- duanhuang4841 2010-05-04 10:24关注
You'll have to know that Javascript and PHP run on two different servers. So they can not communicate directly.
You'll basicly have two options:
POST the value
Make a form with a post action, submit the form, and you can access the value in PHP with the
$_POST
arrayDisadvantage is that the browser leaves the page to submit the form, but it doesn't require javascript.
Use AJAX
Get the value in Javascript, make an XMLHTTPRequest to the server, and you can access the variable too via
$_GET
or$_POST
, depending on how you sent the value.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 逻辑谓词和消解原理的运用
- ¥15 请求分析基于spring boot+vue的前后端分离的项目
- ¥15 三菱伺服电机按启动按钮有使能但不动作
- ¥15 js,页面2返回页面1时定位进入的设备
- ¥200 关于#c++#的问题,请各位专家解答!网站的邀请码
- ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
- ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
- ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?