Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of WeChat Mini Programs's form submission and PHP background data Interactive processing

Shulou Source: shulou.com Published: 2022-06-03 17:45:32 11月13日 Update

This article is to share with you the content of an example analysis of WeChat Mini Programs's form submission and PHP background data interaction. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The details are as follows:

[form form submission]

Form.wxml:

Nickname: password: gender: female and male hobbies: smoking, drinking, perm status: grade: submit reset

Form.js:

Page ({formSubmit: function (e) {console.log ('submit event occurred in form, submit data:', e.detail.value)}, formReset: function () {console.log ('reset event occurred in form')}})

Submit trigger formSubmit:

Reset trigger formReset:

[submit form data to PHP backend server]

Send a HTTPS request using wx.request API

Front desk form.js:

Page ({formSubmit: function (e) {wx.request ({url: 'https://www.msllws.top/getdata.php', data: {' nickname': e.detail.value.nickname, 'password': e.detail.value.password,' sex': e.detail.value.sex, 'status': e.detail.value.status,' aihao': e.detail.value.aihao, 'grade': e.detail.value.grade}) Method:'POST', header: {'Content-Type':' application/x-www-form-urlencoded'}, success: function (res) {console.log (res.data)})})

Background API getdata.php:

Tags: Data background foreground interface example form name program processing content status page prompt analysis success event file log more article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Shulou Tech Info Microsoft macOS