Ok, I hate that buzzword too, but im a bit stuck. can anyone explain/know any good tutorials on AJAX? nice and simple ones, all the ones I find dont go into detaill and have too much baggage attatched. pretty much what im trying to do is make my shoutbox refresh itself. so when someone clicks submit, its doesnt have to refresh the entire page. heres the shoutbox: http://www.barrelofmunkys.co.uk/Temp/shoutbox.php . nice and simple.
Heres the code for it:
its part of a complete site, so ignore the sloppy coding, most of it is just so it can be used stand alone.
any help is greatly appreciated!
Heres the code for it:
Code:
<?php
include("inc/config.php");
include("inc/globals.php");
$loggedin = true;
$Username = "Todd";
$user_id = 6;
if (isset($_POST['submit'])){
$shout = $_POST['shout'];
mysql_query("INSERT INTO shoutbox VALUES(null, '$user_id', '$Username', '$shout', NOW());")or die(mysql_error());
echo "<meta http-equiv=Refresh content=0;url=shoutbox.php>";
}else{
$shout_result = mysql_query("SELECT * FROM shoutbox ORDER BY shout_id DESC")or die(mysql_error());
?>
<div id="shoutbox">
<div class="area" align="center">
<div class="title">Shoutbox</div>
<div class="box">
<?php while ($shout_row = mysql_fetch_assoc($shout_result)){
echo "<div class=\"shoutuser\">".$shout_row['shout_postername'].": </div>";
echo "<div class=\"shout\">".$shout_row['shout_body']."</div>";
};
?>
</div>
<?php if (!$loggedin){
echo "You need to be logged in to submit a comment!<br />Login HERE, or Register HERE<br>";
}else{ ?>
Type your message here:
<form action="shoutbox.php" method="post">
<input name="shout" type="text" size="26" maxlength="100" />
<input name="submit" type="submit" value="Submit">
</form>
<?php } ?>
</div>
</div>
<style>
#shoutbox .area{
width:200px;
border:1px #000 solid;
}
#shoutbox .title{
text-align:center;
background-color:#8C8DDD;
color:#ffffff;
border-bottom:1px #000 solid;
}
#shoutbox .box{
margin:10px;
height:250px;
border:1px #000 solid;
overflow:auto;
}
#shoutbox .shouter{
font-size:13px;
}
#shoutbox .shoutuser{
font-size:12px;
text-align:left;
padding:2px;
text-decoration:underline;
}
#shoutbox .shout{
font-size:12px;
text-align:left;
padding:2px;
}
#shoutbox .commentbox{
}
</style>
<?php } ?>
its part of a complete site, so ignore the sloppy coding, most of it is just so it can be used stand alone.
any help is greatly appreciated!






