Jump to content

PHP Problem


Monk3h

Recommended Posts

This is a mini chat system im using, its displayed in the top right corner of my site, it works fine apart from when i click Chat to post a message it takes me to chat.php.

 

How would i change this script so that it dosnt take me to chat.php but still does the action. =/

 

<?php

Print"<center>
<form method=post action=chat.php?action=minichat>
<tr><td colspan=2 align=center>
<input type=text name=msg size=15> <input type=submit value=Chat>
</form></center>";

} if ($action == minichat) {
if ($msg){

		if ($stat[rank] == Admin) {
		$starter = "<span style=color:#0066cc>$stat[user]</span>"; 
		} elseif ($stat[sub] > 0) {
		$starter = "<span style=color:#FF0000>$stat[user]</span>"; 
		} elseif ($stat[rank] == Staff) { 
		$starter = "<span style=color:#629632>$stat[user]</span>"; 



} else {
		$starter = "$stat[user]";
	}
	mysql_query("insert into chat (user, chat) values('$starter', '$msg')");
mysql_query("update players set chatline=chatline+1 where id=$stat[id]");
}
}
?>

		<iframe src=minichat.php width='100%' height=306 id=ifr name=ifr frameborder=0></iframe>




	</td></tr>
	</table><br>

 

 

BTW, Chat .php is the main chat script.

Link to comment
Share on other sites

Asynchronous Javascript and XML.  It's basically using Javascript to send asynchronous requests to another file (IE, chat.php) so page reloads aren't necessary.  PM me if you want a working example of Ajax on the user list I made on my little test site. xD

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.