ajax前台提交数据后台如何处理,很简单的!

WBOY
Release: 2016-06-23 13:45:46
Original
905 people have browsed it

最近领导布置了个任务,抽奖后把相关数据插入数据库,但是PHP我是初学者,不知道怎么和前台配合
我简化一下,大致就是下面这个意思,要数据库里插入id和电话
var submitData = {
tid: 888,
tel: tel,
action: "setTel"
};
$.post(kkk.php?aa=ccc, submitData,function)

请问kkk.php里面应该怎么写入数据?假设数据库名字叫A,有两个字段叫ID和TEL
谢谢!


回复讨论(解决方案)

$sql = "insert into A (id, tel) values ('$_POST[id]', '$_POST[tel]')");

哈哈,我试试,原来直接可以$_POST过来?

取值还是$_REQUEST好

3L是什么意思,我还没试,你可以说具体点吗

是可以直接 用$_POST[ ' ' ]取值 取值的时候 过滤下参数就可以直接用insert语句

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!