shaunno2007 Posted September 11, 2008 Share Posted September 11, 2008 OK check my shoutbox out at www.link-search.co.nr/shoutbox.php and as you see it has ajax all i want to do is after someone submits a shout it echos out "shout send" or something i will post the shoutbox on here.... shoutbox.php <h1>Shoutbox</h1> <div id="shoutbox"> <form id="shout" name="shoutbox" method="POST" onsubmit="saveData(); return false;"> <p>Name:<br /> <input name="shouter" type="text" class="shouter" size="10" maxlength="15" /> URL/Email: <input name="shouter_contact" type="text" class="shouter_contact" size="10" /> Comment: <input name="shouter_comment" type="text" class="shouter_comment" value="" size="16" /> <input name="submit" type="submit" class="submit" id="submit" value="submit" /> </p> </form></div> <div id="shoutarea"> </div> sendshout.php <?php include("shoutbox-connect.php"); open_connection(); $shouter=addslashes(strip_tags(htmlspecialchars($_POST['name'], ENT_QUOTES))); // Cleans Input. $shout=addslashes(strip_tags(htmlspecialchars($_POST['message'], ENT_QUOTES))); // Cleans Input. $contact=addslashes(strip_tags(htmlspecialchars($_POST['contact'], ENT_QUOTES))); // Cleans Input. $timestamp = date("Y-m-d H:i:s"); //echo $temp; $shout_sql = "INSERT into shoutbox (name, date, content, link) VALUES ('$shouter', '$timestamp', '$shout', '$contact')"; $shout_result = mysql_query($shout_sql); ?> outputinfo.php <?php header("Expires: Sat, 05 Nov 2005 00:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); include("shoutbox-connect.php"); open_connection(); $shout_query = "SELECT * FROM shoutbox ORDER BY `date` DESC LIMIT 0 , 15" ; $shout_result = mysql_query($shout_query); $count = 0; while($shout_row = mysql_fetch_array($shout_result)) { $shouter_name = $shout_row['name']; $shout_content = $shout_row['content']; $shout_content = stripslashes($shout_content); $shout_date = $shout_row['date']; $shouter_contact = $shout_row['link']; $contact_count = 0; $dday = substr($shout_date, 8, 2); $dmonth = substr($shout_date, 5, 2); $dyear = substr($shout_date, 0, 4); if(($count % 2) != 0) { echo "<p class='odd'><a href='http://$shouter_contact'><font color='#FFFFFF'>$shouter_name</a></font> - $shout_content <font color='#FFFFFF'>$dday-$dmonth-$dyear</font></p>"; } else { echo "<p class='even'><a href='http://$shouter_contact'><font color='#FFFFFF'>$shouter_name</a></font> - $shout_content <font color='#FFFFFF'>$dday-$dmonth-$dyear</font></p>"; } $count++; } if(isset($_POST['submit'])) { echo "Shout successfully sent"; } // as you can see here i tryed if(isset($_POST['submit'])) but i don't work ?> database-connect.php <?php $host = "localhost"; $user = "root"; $pass = ""; $db = "bizlizard"; $table = "websites"; $connect = mysql_connect($host, $user, $pass); mysql_select_db($db); ?> if there is anything i have miss then please say or if you want something else what will hellp you help me with this say thank you Quote Link to comment Share on other sites More sharing options...
shaunno2007 Posted September 13, 2008 Author Share Posted September 13, 2008 anyone ??????????????? Quote Link to comment Share on other sites More sharing options...
gaza165 Posted September 13, 2008 Share Posted September 13, 2008 i use jquery for my shoutbox.... check out http://www.thedesignmonkeys.co.uk for my shoutbox Quote Link to comment Share on other sites More sharing options...
gaza165 Posted September 13, 2008 Share Posted September 13, 2008 a problem that i flagged up with mine is that you are running the query again and again.. so if there is 250 records in the db and someone posts a shout, it goes through the whole 250 other records to find one i.e latest record. Quote Link to comment Share on other sites More sharing options...
DjMikeS Posted September 13, 2008 Share Posted September 13, 2008 OK check my shoutbox out at www.link-search.co.nr/shoutbox.php and as you see it has ajax all i want to do is after someone submits a shout it echos out "shout send" or something i will post the shoutbox on here.... I don't see AJAX there...AJAX is javascript so could you also post the javascript ? Quote Link to comment Share on other sites More sharing options...
shaunno2007 Posted September 13, 2008 Author Share Posted September 13, 2008 i did not make this script just to say am not that good lol here is the link where i got it from http://boonage.pjss2.net/2007/02/12/ajaxphp-shoutbox-tutorial/ Quote Link to comment Share on other sites More sharing options...
shaunno2007 Posted September 14, 2008 Author Share Posted September 14, 2008 http://www.boonage.pjss2.net/2007/02/12/ajaxphp-shoutbox-tutorial/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.