-
Notifications
You must be signed in to change notification settings - Fork 0
/
chatterbox.php
40 lines (38 loc) · 960 Bytes
/
chatterbox.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
?>
<html>
<head>
<title>Chatter Box</title></head>
<script>
function submitChat(){
if(form1.uname.value ==' '||form1.msg.value ==' '){
alert('ALL FIELDS ARE MANDATROY!!!');
return;}
var uname=form1.uname.value;
var msg=form1.msg.value;
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4&&xmlhttp.status==200){
document.getElementById('chatlogs').innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open('GET','insert.php?uname='+uname+'&msg='+msg,true);
xmlhttp.send();
}
</script>
<body>
<form name="form1">
<p>Enter Your Chatname:
<input type="text" name="uname" /></br>
</p>
<p>Your Message:<br />
<textarea name="msg"></textarea>
</br>
</p>
<p> <a href="#" onclick="submitChat()">SEND</a>
</p>
<div id="chatlogs">
LOADING CHATLOGS PLEASE WAIT...
</div>
</body>
</html>