Home  >  Article  >  Backend Development  >  类似问卷的HTML中js获取了用户选择答案,怎么传值到PHP

类似问卷的HTML中js获取了用户选择答案,怎么传值到PHP

WBOY
WBOYOriginal
2016-06-13 12:04:55966browse

类似问卷的HTML中js获取了用户选择答案,如何传值到PHP
php基本零基础,现在急需写一个调查问卷页面,在写提交按钮相应。
通过循环得到所有的题目的答案,放到一个数组里面,同时也写好了通过答案得到结果的算法,一个php文件
但是不知道应该怎么在php文件里面调用这个答案数组,比较笨,求解。
------解决方案--------------------
你总是要发送给 php 的吧
------解决方案--------------------
提交给PHP,不外乎两种,1、form提交    2、Ajax提交  

你想清楚用哪种了吗
------解决方案--------------------
直接post 提交,计算不就得了么?
------解决方案--------------------
你的问卷内容放到一个

里   


用$_POST 获取  你baidu吧
------解决方案--------------------
form 的action='PHP文件'

或者用AJAX 提交吧 都都可以
------解决方案--------------------
基础问题,只可意会不可言传。
------解决方案--------------------
表单提交,通过form标签控制,可查看html form内容。
ajax异步处理,可以查看js或者jquery的ajax相关内容。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn