Home >Backend Development >PHP Tutorial >PHP combined with js implements click on hyperlink to perform delete confirmation operation, js hyperlink_PHP tutorial
As the title says, this time we want to execute the js code by clicking on the hyperlink and confirm whether to delete the database data, using php.
First connect to the database and query the database data:
';<br> echo "Error: " . $e->getMessage(). "<br/>"; <br> echo "Code: " . $e->getCode(). "<br/>";<br> echo "File: " . $e->getFile(). "<br/>";<br> echo "Line: " . $e->getLine(). "<br/>";<br> echo "Trace: " . $e->getTraceAsString(). "<br/>";<br> echo '';
Delete
Click OK to jump directly to the delete page.
Click Cancel and leave it unchanged.
php gets url parameters
$id = $_GET[id];
If you still don’t understand anything, you can leave me a message through Baidu Hi.
Delete
When foreach traverses the data, write the id value, and then perform the delete operation on the delete.php page.
Either you include the page connecting to the database into delete.php (not recommended)
Or write them all on one page, and then switch case to determine whether the operation accepts the id and then execute
Delete It is recommended to
delete.php page
connect the database switch($act=$_GET['act']){ case 'del' : .........;break;case....}