How to handle post data from an html file to a php file and check the data in the PHP file? if the data is incorrect, a prompt is displayed in the html file to re-enter the data.

Source: Internet
Author: User
How can I check the data from an html post to a php file and then check the data in the PHP file? if there is a data error, a prompt is displayed in the html to re-enter the data? For example, if a new user of a website is registered and the user name exists, how does one check and a prompt dialog box appears? Or if the entered login password is incorrect, how does one prompt an error after checking? Which of the php tag and script tag can be set in? I figured out a way to implement it, but php and javascript are required to be combined, but how can I check the data in the php file after processing the data from the html post to a php file, if the data is incorrect, the prompt "re-input" appears in html?
For example, if a new user of a website is registered and the user name exists, how does one check and a prompt dialog box appears? Or if the entered login password is incorrect, how does one prompt an error after checking? Which of the php tag and script tag can be set in? I tried to implement it, but php and javascript are needed, but I don't know how to nest it.

------ Solution --------------------
Let's take a look at the PHP and mysql web development system ..
------ Solution --------------------
Example
A.
User input registration name
Triggered after the input is complete, the mouse focus is left, or triggered in other ways, depending on the method you need
Trigger ajax events
B.
Ajax uses GET or POST to pass the user name to the server.
For example? Username = test

Server checkName. php
C. The server checkName. php checks whether the user name is repeated and returns the result to ajax.

D. ajax performs output processing based on the returned information (the jquery pop-up p is displayed ).

The process looks like this. let's look at jquery and handle this encapsulated code.
------ Solution --------------------
The newnew process has all been mentioned ~ You can write the specific code.

----
For example, if a new user of a website is registered and the user name exists, how does one check and a prompt dialog box appears?
This requires ajax to submit the check.

----
Or if the entered login password is incorrect, how does one prompt an error after checking?
This also requires ajax to submit the check.

----
Which of the php tag and script tag can be set in?
I tried to implement it, but php and javascript are needed, but I don't know how to nest it.

JavaScript code blocks cannot be embedded in php labels. you can print and echo the output.
JavaScript code blocks can be embedded with php code.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.