11 lines of php + js
Function del (){
If (! Confirm ("Are you sure you want to delete these records? Submitted records cannot be deleted! ")){
Return;
}
Document. location = "delete1.php? Lmbs = & Amp; id = ";
}
Script
If you add the Baidu website after document. location, the function can be implemented normally.
Maybe something wrong with php in js?
Reply to discussion (solution)
Document. location = "delete1.php? Lmbs = & Amp; id = ";
I don't quite understand what it means, but it still cannot be implemented after it is removed from the first floor.
Script function del () {if (! Confirm ("Are you sure you want to delete these records? Submitted records cannot be deleted! ") {Return;} document. location =" http://baidu.com/";} script
You think of it like this. I used to work on it.
We recommend that you install Firefox firebug js and report an error.
Are you sure you want to jump to the delete1.php page?
What do you mean by "unimplemented?
According to the third floor, I put the script partNow the page jumps to delete1.php, but the delete1.php page does not receive the id
$ Array ['id'] has a value? Output ..
I don't quite understand what it means, but it still cannot be implemented after it is removed from the first floor.
Amp is & escape of this symbol
Location can only jump, cannot pass value
Use action
Location can only jump, cannot pass value
Use action
Function del (){
If (! Confirm ("Are you sure you want to delete these records? ")){
Return;
}
Document. action = "delete1.php? Lmbs = & Amp; id = ";
} Is that true?
However, click delete. In the pop-up dialog box, after you press "OK", nothing will happen.
$ Array ['id'] has a value? Output ..
Previously I used $ select = mysql_query ("select * from tb_content", $ conn );
$ Array = mysql_fetch_array ($ selects );
I added an echo and output it. each post is displayed with an id.
No response indicates that the post is not deleted and should not be transferred to delete1.php.
No response indicates that the post is not deleted and should not be transferred to delete1.php.
Print_r ($ _ GET) in delete1.php );
Let's see what they all have.
Result of print_r: failed Array ([lmbs] => Topic management [id] =>)
The lmbs value is passed, and the id does not exist.
I'm going to take the test on microorganisms first. we will take the electives. thank you very much. I will come back to study it later in the evening.
Check the page "Source Code" in document. location = "delete1.php? Lmbs = & Amp; id = "; What are the corresponding parts?
Check the page "Source Code" in document. location = "delete1.php? Lmbs = & Amp; id = "; What are the corresponding parts?
I added an if ($ _ GET ['id']) to delete1.php.
The result is that no id is obtained
I'm going to take the test on microorganisms first. we will take the electives. thank you very much. I will come back to study it later in the evening.
"Microorganisms"... Haoniu ~~ How many pets can be made?
Function del () {if (! Confirm ("Are you sure you want to delete these records? Submitted records cannot be deleted! ") {Return;} document. location =" delete1.php? Lmbs =
& Amp; id =
";}
Logic problem, your document. location finally gets the ID in the string without any value ....
PHP is on the server side, JS is on the client side, and your id = Obviously, there is no value. The id here can only be obtained through JS.
Function del () {if (! Confirm ("Are you sure you want to delete these records? Submitted records cannot be deleted! ") {Return;} else {// here, write some code and use JS to obtain the selected ID. Then, use", "to merge and return the result as a string. // document. location = "delete1.php? Lmbs =
& Amp; id = "+ id ;}}
Alert ('delete1. php? Lmbs = & Amp; id = ";');
Right.
The values in JS can only be obtained through JS. you should use the ID to delete a record. you can use jquery to write it!