Php processes two buttons in a form to determine whether the database exists (I need to press submir1 to determine whether the user exists, and press sunmir2 to determine whether the password exists)
The following is the online search code, and the test does not respond. could you tell me how to change it?
If (isset ($ _ POST ['submit1']) {
// If ($ _ POST ["submit"]) {
Echo "script" alert ('Button 1'); location = '? Tj = register '; script ";
If (empty ($ _ POST ['submit2'])
Echo "script" alert ('Button 2'); location = '? Tj = register '; script ";
}
?>
My source code is as follows: I did not respond to any submission. please help me to see the problem. (I need to press submir1 to determine whether the user exists, and press sunmir2 to determine whether the password exists)
If (isset ($ _ POST ['submit ']) {
$ Name = $ _ POST ['user'];
$ SQL = "select * from ot_user where UE_account = '". $ name ."'";
$ Result = mysql_query ($ SQL) or die ("incorrect account ");
$ Num = mysql_num_rows ($ result );
If ($ num = 0 ){
// Echo "script" alert ('account can be registered '); location = '? Tj = register '; script ";
}
While ($ rs = mysql_fetch_object ($ result ))
{
{
$ _ SESSION ['ot _ user'] = $ _ POST ['ue _ account'];
Echo "script" alert ('The account has been registered! '); Location = '? Tj = register '; script ";
Mysql_close ();
}
}
} Else if (isset ($ _ POST ['submit1']) {
$ Name = $ _ POST ['pass'];
$ SQL = "select * from ot_user where UE_accname = '". $ name ."'";
$ Result = mysql_query ($ SQL) or die ("incorrect password ");
$ Num = mysql_num_rows ($ result );
If ($ num = 0 ){
}
While ($ rs = mysql_fetch_object ($ result ))
{
{
$ _ SESSION ['ot _ user'] = $ _ POST ['ue _ account'];
Echo "script alert ('The password already exists! '); Location = '? Tj = register '; script ";
Mysql_close ();
}
}
}
?>
Reply to discussion (solution)
The code hasn't been viewed yet
However, you have a lot of questions. from the product perspective, you can ask people not to set the same password)
Copy it to my local computer and you will see that the last braces '}' are written in Chinese. can this program run smoothly... Didn't you respond?
The code hasn't been viewed yet
However, you have a lot of questions. from the product perspective, you can ask people not to set the same password)
Copy it to my local computer and you will see that the last braces '}' are written in Chinese. can this program run smoothly... Didn't you respond?
This should have been added after me. after the change, it still won't work.
The code hasn't been viewed yet
However, you have a lot of questions. from the product perspective, you can ask people not to set the same password)
Copy it to my local computer and you will see that the last braces '}' are written in Chinese. can this program run smoothly... Didn't you respond?
This should have been added after me. after the change, it still won't work.
The code hasn't been viewed yet
However, you have a lot of questions. from the product perspective, you can ask people not to set the same password)
Copy it to my local computer and you will see that the last braces '}' are written in Chinese. can this program run smoothly... Didn't you respond?
This should have been added after me. after the change, it still won't work.
Let's take a look at your code. one form and two submit buttons are not differentiated into different operations. what do you mean? No matter which button you submit, it is the same as the data in all forms in the form. So one button is the same as the other two buttons. If you want to submit a table with different buttons, you need to use js for different operations. Below is a js that I recently submitted with different buttons to submit the same form for different operations, for more information, see (use js in the jQuery library)
Function ordersFormSubmit (href_link, form_action ){
ActionPath = href_link + '& action =' + form_action;
$ ('# OrdersForm'). attr ('action', actionPath );
$ ('# OrdersForm'). submit ();
}