Home>

After we implemented the php popup dialog,Generally also need to return to the original page or replace the original page with a new page, etc.This article will explain the detailed code writing,

Many programmers use PHP for web development. Then in a website, you will often encounter functional requirements such as dialog popups.Below we will introduce in detail the related implementation methods of the PHP popup dialog.

1.php popup dialog

<?php
echo "<script language =
\ "javascript \">alert
(\ "Hello \");</script>";
?>
//or
<?php
print "<script language =
\ "javascript \">alert
(\ "Hello \");</script>";
?>

2. If you need PHP to pop up the dialog box and return to the original page, you can write

<?php
echo "<script language =
\ "javascript \">\ r \ n ";
echo "alert (\" Hello \ ");\ r \ n";
echo "history.back ();\ r \ n";
echo "</script>";
exit;
?>
//or
<?php
print "<script language =
\ "javascript \">\ r \ n ";
print "alert (\" Hello \ ");\ r \ n";
print "history.back ();\ r \ n";
print "</script>";
exit;
?>

3. If you need to replace the original page (replace the current history) with a new page after the PHP pop-up dialog box, the original page can be written like this

<?php
echo "<script language =
\ "javascript \">\ r \ n ";
echo "alert (\" Hello \ ");\ r \ n";
echo "location.replace
\ r \ n ";//Modify URL yourself
echo "</script>";
exit;
?>
or
<?php
print "<script language =
\ "javascript \">\ r \ n ";
print "alert (\" Hello \ ");\ r \ n";
print "location.replace
\ r \ n ";//Modify URL yourself
print "</script>";
exit;
?>

This article introduces three situations of php popup dialogs,Hope to help you master the implementation method of PHP pop-up dialog box.

php
  • Previous The composition and creation of derived classes in C ++ programming
  • Next What to do if mysql installation fails