conan318 Posted September 6, 2011 Share Posted September 6, 2011 hi i am trying to make place where users can post messages to each other i have it working in php but the trouble the page needs to refresh for it work. looking for some help to write in this in ajax. i have no experience with ajax so if someone could point me in the right direction much appreciated <div class="form"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <INPUT type="text" name="message" SIZE="30" VALUE=""> <input type="hidden" name="submit" value="Update Status"> </form> </div> <div class="posts" id="posts" style="display: block;"> <?php $data = mysql_query("SELECT * from cvisinko_db.posts,users WHERE posts.username=users.username ORDER BY posts.id DESC LIMIT 10;") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo "<img src='img/".$info['img'] ."' width='30' height='30''>"." ". $info['username'].": ".$info['message']."<br>"; echo "<hr>"; } if(isset($_POST['submit'])) { $message = $_POST['message']; mysql_query("INSERT INTO cvisinko_db.posts (message, username ) VALUES ('$message','$myusername')") OR die("Could not send the message: <br>".mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/246507-re-write-in-ajax/ Share on other sites More sharing options...
trq Posted September 6, 2011 Share Posted September 6, 2011 Ajax is simple if you use a framework such as jQuery. I would start there. Link to comment https://forums.phpfreaks.com/topic/246507-re-write-in-ajax/#findComment-1265810 Share on other sites More sharing options...
ZulfadlyAshBurn Posted September 7, 2011 Share Posted September 7, 2011 read this website. it will help you Link to comment https://forums.phpfreaks.com/topic/246507-re-write-in-ajax/#findComment-1266431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.