Nexy Posted June 21, 2008 Share Posted June 21, 2008 Why Hello There! The following code works fine to some extent. <?php $shomes = mysql_real_escape_string(stripslashes($_POST['shoutext'])); $sshuser = mysql_real_escape_string(stripslashes($_SESSION['username'])); $cshuser = mysql_real_escape_string(stripslashes($_COOKIE['user'])); $shtime = mysql_real_escape_string(stripslashes(date('h:i:s a'))); ?> <div class='create margin' style='font-size: .8em; width: 700px; margin-top: .8em; margin-bottom: 0'> Shoutbox ( <a href="javascript:;" onmousedown="if(document.getElementById('shoutbox').style.display == 'none' && document.getElementById('shoutform').style.display == 'none') { document.getElementById('shoutbox').style.display = 'block'; document.getElementById('shoutform').style.display = 'block'; } else { document.getElementById('shoutbox').style.display = 'none'; document.getElementById('shoutform').style.display = 'none' } ">Show/Hide</a> ) </div> <div id="shoutbox" style="display:none"> <?php $shsql = "SELECT * FROM shoutbox WHERE id > 0 ORDER BY id DESC"; $shres = mysql_query($shsql) OR die(mysql_error()); while($shout = mysql_fetch_array($shres)) { echo $shout['time'] . " " . $shout['user'] . ': ' . $shout['message'] . '<br />'; } ?> </div> <div id="shoutform" style="display: none"> <?php if($_POST['shoutsub'] && $sherror == "1") { echo "<span style='color: red'>Please enter a message!</span>"; } ?> <form action="#' method="post"> <fieldset id='shout'> <label for="shoutext">Message:</label> <input type="text" id="shoutext" name="shoutbox" tabindex="6" style="width: 500px" /> <input type="submit" id="shoutsub" name="shoutsub" value="Shout!" tabindex="7" /> </fieldset> </form> </div> <?php if($_POST['shoutsub']) { if(!empty($shomes)) { if($_SESSION['username']) { mysql_query("INSERT INTO shoutbox(user, time, message) VALUES('$sshuser', '$shtime', '$shomes')"); } else if($_COOKIE['user']) { mysql_query("INSERT INTO shoutbox(user, time, message) VALUES('$cshuser', '$shtime', '$shomes')"); } } if(empty($shomes)) { $sherror = "1"; } } ?> The problem is, when I click submit, the url becomes something like this: http://divnx.net/index.php?shoutbox=&shoutsub=Shout!#%27%20method= Thus, my php part is completely ignored. The collapsible div works just fine, only problem with the submit. Any help would be appreciated. Thank You! Quote Link to comment Share on other sites More sharing options...
Nexy Posted June 21, 2008 Author Share Posted June 21, 2008 NVM, it became a php problem. I'll post over there. 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.