yakabod Posted September 21, 2008 Share Posted September 21, 2008 I been looking at this for a while now and still can't figure it out. How do I have the form on the left side and the contentbox on the right side? I don't want a break between the form and contentbox because I want the site to look more cleaner. If you guys want, I can create a visualization for you guys. This is my site: www.PFCPicks.com Here's the code: <style type="text/css"> <!-- #contentbox { background: #E5E5E5; border:dotted; border-color:#000000; padding: 5px; width: 400px; height: 125px; overflow: auto; } ul#shoutboxmessage { margin: 0; padding: 0; list-style-type: none; color: #000000; font: normal 10px verdana,tahoma,arial; } .style2 {font-family: Tahoma; font-size: 10px; } --> </style> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" /> <strong> Pool Name:</strong><br/> <input type="text" name="name" maxlength="20"><br/> <strong>Message:</strong><br/> <textarea name="message"></textarea><br/> <input type="submit" name="submit" value="Shout It!"> </form> <?php require_once("config.php"); $name = $_POST['name']; $message = $_POST['message']; $ip = $_POST['ip']; $mlen = strlen($message); $maxlength = 200; $date = date("M jS Y"); if ($_POST['submit']) { if ($name == "") { echo "<strong>Error: Please enter your nickname.</strong>"; } else if ($message == "") { echo "<strong>Error: No message to be sent.</strong>"; } else if ($mlen > $maxlength) { echo "<strong>Error: Message too long.</strong>"; } else { $db = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); mysql_query("INSERT INTO shoutbox(name,message,date,ip) VALUES('$name','$message','$date','$ip')"); } } $db = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($dbname) or die(mysql_error()); $query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 20"; $result = mysql_query($query); echo "<div id=\"contentbox\">\n"; echo "<ul id=\"shoutboxmessage\">\n"; while($r = mysql_fetch_array($result)) { $name = $r['name']; $name = strip_tags($name); $message = $r['message']; $message = strip_tags($message); echo "<li><strong>>$name</strong>: $message</li>\n"; } echo "</ul>\n"; echo "</div>\n"; mysql_close($db); ?> </div> 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.