Jump to content

[SOLVED] PHP Popup


herghost

Recommended Posts

Is it possible to do a purely PHP popup message box?

 

I cant seem to find one that doesnt involve java or ajax!

 

Basically I have this:

 

if(isset($_GET['update']))
{

                                                                                                                                                                                                                                        
echo "thanks for registering, you may now login";

}

 

and I want the text to pop up in a box?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/155112-solved-php-popup/
Share on other sites

Thanks,

 

I have tried putting a javascript query in here, but I cant work out how to do it with php, any pointers?

 

I have tried this:

 

if(isset($_GET['update']))
{
echo "<SCRIPT LANGUAGE='javascript'>window.onload=function(popupMsg('message here'));</SCRIPT>";
                                                                                                                                                                                                                                        


}

 

and calling this in the header

 

function popupMsg(msg) 
{ 
  alert(msg);
}

 

but to no avail

Link to comment
https://forums.phpfreaks.com/topic/155112-solved-php-popup/#findComment-815954
Share on other sites

I tried this and it works

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?php
if(isset($_GET['update']))
{
   echo "<SCRIPT LANGUAGE='javascript'>window.onload=alert('message here');</SCRIPT>";
}
?>
</head>

<body>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/155112-solved-php-popup/#findComment-815978
Share on other sites

Just fixing outdated code.

 

   echo "<script type='text/javascript'>window.onload=alert('message here');</script>";

 

The language attribute has been depreciated for a while. It is better to use the type="text/javascript" for correct markup etc. Why even add the window.onload? Just simply calling alert would work.

Link to comment
https://forums.phpfreaks.com/topic/155112-solved-php-popup/#findComment-815998
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.