开发者

How to create a pop up window using php via echo?

开发者 https://www.devze.com 2023-04-05 09:39 出处:网络
Is it possible to make a pop up window in my existing script? se开发者_运维技巧ssion_start(); $_SESSION[\'success\'] = ($result) ? TRUE : FALSE;

Is it possible to make a pop up window in my existing script?

se开发者_运维技巧ssion_start();

$_SESSION['success'] = ($result) ? TRUE : FALSE;

header('location: inv_fc.php');

session_start();
if ($_SESSION['success'] == TRUE) {
// CREATE POP UP WINDOW SUCCESS
} else {
// CREATE POP UP WINDOW FAILURE
}


You can do it with Javascript. For nicer results, use jQuery UI.

if ($_SESSION['success'] == TRUE) {
    echo "<script>alert('Success!');</script>";
} else {
    echo "<script>alert('Failure.');</script>";
}


You could open a pop-up using javascript or target a's attribute, but it's impossible from PHP, which is executed at server side.

Edit: ok, as I saw the <script> things: it's not PHP, it's Javascript, from PHP it's not possible.


<?php if ($_SESSION['success'] == TRUE)?>
  <script>window.open(...);alert('Your Awesome!');</script>
<?php else ?>
  <script>window.open(...);alert('You Fail!!');</script>
<?php endif; ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消