PHP Novice Related issues! Ask your heroes to show you the maze!
Source: Internet
Author: User
PHP Novice Problem!! Ask your heroes to guide the maze!!
I got an open source project on the Internet. The only place where the registration verifies the username is a problem.
JS Call PHP file verification but do not know why the return of a 0 do not know there is a mistake.
JS Code:
function Chkname (form) {
if (form.name.value== "")
{
Name1.innerhtml= "Please enter your user name! ";
}
Else
{
var user = Form.name.value;
var url = "chkname.php?user=" +user;
Xmlhttp.open ("GET", url,true);
Xmlhttp.onreadystatechange = function ()
{
if (xmlhttp.readystate = = 4)
{
var msg = Xmlhttp.responsetext;
if (msg = = ' 2 ') {
Name1.innerhtml= "user name is occupied! ";
return false;
}else if (msg = = ' 1 ') {
Name1.innerhtml= "Congratulations, you can register!";
Form.c_name.value = "Yes";
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.