onthespot Posted August 15, 2006 Share Posted August 15, 2006 [code]<form action="insert12.php" method="post">Title: <input type="text" name="title" value"<? echo $form->value("title"); ?>" />Text: <input type="text" name="text" value"<? echo $form->value("text"); ?>" /><input type="submit" /></form><?phpif(empty($title) || empty($text)) exit("You didn't completely fill in the form!");// we're presuming here that you used 'title' and 'text' as the names for your form elements$title = addslashes($title);$text = addslashes($text);// add slashes to the sent info so no escape characters are around (they'll possibly bust the script)mysql_query("INSERT INTO news (title,text) VALUES ('$title','$text')"); ?>[/code]this code is allowing me to submit the news, however, its not showing a message saying news piece added, and its always showing the "you didnt fill in form" even when the title and text are not empty!any ideas Quote Link to comment Share on other sites More sharing options...
Barand Posted August 16, 2006 Share Posted August 16, 2006 tryif(empty($_POST['title']) || empty($_POST['text'])) exit("You didn't completely fill in the form!"); Quote Link to comment Share on other sites More sharing options...
trq Posted August 16, 2006 Share Posted August 16, 2006 Q/ Where do you define $title and $text?A/ You dont. Replace them with $_POST['title'] and $_POST['text'] and you might have more luck. Quote Link to comment Share on other sites More sharing options...
onthespot Posted August 16, 2006 Author Share Posted August 16, 2006 still not working ??? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted August 16, 2006 Share Posted August 16, 2006 It appears register globals is off (which is good!)try:$title = isset($_POST['title']) ? addslashes($_POST['title']) : NULL;$text = isset($_POST['text']) ? addslashes($_POST['text']) : NULL;if (is_null($title) || is_null($text)) { exit("You didn't completely fill in the form!");}.... Quote Link to comment Share on other sites More sharing options...
onthespot Posted August 16, 2006 Author Share Posted August 16, 2006 stick not working ?? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 16, 2006 Share Posted August 16, 2006 echo $form->value("title");Where is $form defined? Quote Link to comment Share on other sites More sharing options...
onthespot Posted August 16, 2006 Author Share Posted August 16, 2006 im not sure, im new to php and am getting really confused! 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.