almightyegg Posted September 30, 2007 Share Posted September 30, 2007 I'll start with the codes: The Form: <form action="/chat/index.php" method="POST"> Message: <input type="text" name="message"><br> <input type="submit" value="Post"> </form> Index.php: <? $message = $_POST['message']; if(isset($message)){ $timestamp = date("d-m-Y H:i:s"); $insert = mysql_query("INSERT INTO chat (`timestamp`, `userid`, `message`) VALUES('$timestamp', '{$mem['id']}', '" . mysql_real_escape_string($message) . "')") or die(mysql_error()); unset($message); } ?> It shows no errors it just isn't inserting the info.........I have no idea why?!? also a question, once it is working, and I've unset $message if the user refreshes will it still see the $message, I'm not sure I can explain why I think it might still be there...so thought I'd ask... Quote Link to comment https://forums.phpfreaks.com/topic/71251-problem-with-a-form/ Share on other sites More sharing options...
LemonInflux Posted September 30, 2007 Share Posted September 30, 2007 a) check the mysql details? b) I don't think it would stay there. Quote Link to comment https://forums.phpfreaks.com/topic/71251-problem-with-a-form/#findComment-358362 Share on other sites More sharing options...
almightyegg Posted September 30, 2007 Author Share Posted September 30, 2007 ooh, it was because of an ajax script getting in the way somehow...so that's fixed/... But the $message still remains after being unset....how can I make it disappear? Quote Link to comment https://forums.phpfreaks.com/topic/71251-problem-with-a-form/#findComment-358366 Share on other sites More sharing options...
LemonInflux Posted September 30, 2007 Share Posted September 30, 2007 Not sure. Simplest form, just use $message = ''; Quote Link to comment https://forums.phpfreaks.com/topic/71251-problem-with-a-form/#findComment-358367 Share on other sites More sharing options...
almightyegg Posted September 30, 2007 Author Share Posted September 30, 2007 That didn't work either... Quote Link to comment https://forums.phpfreaks.com/topic/71251-problem-with-a-form/#findComment-358425 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.