<form bindsubmit=“formSubmit” bindreset=“formReset”>
<view class=“xiaobiao”>
<input type=“text” bindblur=‘no_focus’ name=‘dhhm’ bindfocus=“focus” placeholder=“请输入您的电话号码”/>
</view>
<view class=“tijiao”>
<button type=“primary” formType=“submit”>立即申请</button>
js:
formSubmit: function (e) {
var formData = e.detail.value;
console.log(formData)
wx.request({
url: ‘php地址’,
data: {
dhhm: formData.tel
},
header: {
‘content-type’: ‘application/x-www-form-urlencoded’
},
success: function (res) {
console.log(res);
},
fail: function () {
console.log(‘request from fail’)
},
})
},
这个表单提交不到数据库也提交不到后台 不知道什么原因 请大神帮忙修改
注意加下划线的
wxml:
<form bindsubmit=“formSubmit” bindreset=“formReset”>
<view class=“xiaobiao”>
<input type=“text” bindblur=‘no_focus’ name=‘dhhm’ bindfocus=“focus” placeholder=“请输入您的电话号码” />
</view>
<view class=“tijiao”>
<button type=“primary” formType=“submit”>立即申请</button>
</view>
</form>
js:
formSubmit: function (e) {
var formData = e.detail.value;
console.log(formData)
wx.request({
url: ‘php地址’,
data: {
dhhm: formData.dhhm
},
header: {
‘content-type’: ‘application/x-www-form-urlencoded’
},
success: function (res) {
console.log(res);
},
fail: function () {
console.log(‘request from fail’)
},
})
},