Jump to content

Replying to an alert ..sort of


lxndr

Recommended Posts

I'm not sure if this is the best place to ask this question as it all depends on what the answer is.  Basically, I need to modify an existing php program with reads in a file of messages and if there's a message for the user who's running the program it generates a javascript alert with the message displayed in it.

 

What I need to be able to do is provide the means of replying to the alert.  I could do away with the alert altogether of course but I need something that sits on top of the screen in all browsers that can only be got rid off by clicking OK (or by replying).

 

I'm simply not sure of the best way to go about this and would welcome any positive suggestions or help.

 

TIA..

 

Link to comment
https://forums.phpfreaks.com/topic/137875-replying-to-an-alert-sort-of/
Share on other sites

What about a javascript popup window instead of a alert. You could use focus() to bring it to the front so they see it?

 

Then you can have whatever page inside the popup with options for the user to click.

 

 

Do you know if that will that work cross-browser consistently including Opera and Safari ?

 

__

 

No, javascript can be disabled by the user and therefor isn't consistant in any browser. Use something like PHP and make a little class or function to display it at the top of the page each time it loads, then when they do whatever update the status. 

 

php example quick one.

<?php

// display message if field is empty

if (empty($username)) {

$error="Please enter a username.<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";

echo $error;
exit;
}

if (empty($password)) {
    $error= "Please enter a password.<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";
echo $error;
    exit;
} 

if (empty($email)) {
    $error= "Please enter a valid email<br><br>

<a href='whatever.com/start_agin.php'>Try agin</s>";
echo $error;
    exit;
} 



?>

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.