Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP form to popup?

Status
Not open for further replies.

Blood22

Technical User
Jul 14, 2003
7
GB
Hi there,

I don't know if this is possible but I am looking into it anyway!

I have developed a simple PHP system within a secondary school. It is based on the intranet, and the idea behind it is that a member of staff can go anywhere in the school and log a fault through a PHP form, that goes into a MYSQL database and can be retrieved on another page.

As an IT technician based in another office in the school I would have to check the results page every hour or so which is quite inconvenient. Is there any possibility, that when a member of staff enters details into a form and submits that it can direct the results to a popup screen on my pc using ip address or something else?

I am fairly new to PHP so any help at all would be greatly appreciated.

Thanks.

Si22
 
Hi,

Here's one way you could do that:

Make the results page auto-refresh (that's plain HTML).

Have the results page script determine if there have been logged any problems since last refresh.

- If yes, include a pop-up javascript...

- If no, don't...

Good Luck


Jakob
 
Failing that, send an email message from the page that inserts the data into the database, to mail you of new items.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Failing that you could use shell_exec along with "net send" if PHP is running on a windows machine.

Or, setup a jabber server and have it send you an IM

Or download Opera so you can just have it auto-refresh the page for you every so many minutes, then it's no change to anything.
 
I recently wrote a net send application...here is the code


You will need to enable messenger services (not the msn messenger application) on 2000/XP to get this to work

The IP can be the IP of the receving computer, or the computer name if it has one. Enter '/users' to send to all users on a network.

This is tested on an XP machine running apache / php. Should have no issues on IIS / php machines


Now... the code
Code:
<? 
if(!isset($_POST['submit'])){ 
  show_form(); 
}else{ 
  //get message 
  if (isset($_POST['message'])){ 
     $mess = escapeshellcmd($_POST['message']); 
  }else{ 
     echo "no message"; 
     show_form(); 
     die(); 
  } 
  //$ip is the ip of your friends machine...you could build a db table or array to use the name entry to find the ip 
  if (isset($_POST['ip'])){ 
     $ip = escapeshellcmd($_POST['ip']); 
  }else{ 
     echo "no ip"; 
     show_form(); 
     die(); 
  } 
  echo "NET SEND $ip $mess"; 
  exec("NET SEND $ip $mess"); 

} 
function show_form() 
{ 
?> 
    <form method="POST" action="<?=$_SERVER['PHP_SELF'];?>"> 
    <table cellpading=2 cellspacing=2 border=2 width=50%> 
    <tr> 
    <td align=center valign=top> 
    <p>IP<br> 
    <input type="text" name="ip" size="20"></p> 
    </td> 
    </tr> 
    </table> 
    <table cellpading=2 cellspacing=2 border=2 width=50%> 
    <tr> 
    <td align=center valign=top> 
    <p>Message<br> 
    <textarea cols=40 rows=4 name="message"></textarea> 
    <p><input type="submit" name="submit" value="Send"></P> 
    </td> 
    </tr> 
    </table> 
<? 
} 
?>

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top