camdenite Posted February 11, 2009 Share Posted February 11, 2009 Hi all, I've got this: <form action="create_blog.php" method="post"> <td>Category Code<br /> (enter 2-digit code from list on right):<br /> <input type="text" name="category_id" size="5"/></td></tr> <tr> <td valign="top">First Paragraph: <br /> <textarea name="first_para" cols="60" rows="6" /></textarea></td> very basically.The textarea posts but the input doesn't. I've also got this to go with it: // Check for a category_id. if (empty($_POST['category_id'])) { $errors[] = 'You forgot to enter a Category ID.'; } else { $header = escape_data($_POST['category_id']); } // Check for a page title. if (empty($_POST['first_para'])) { $errors[] = 'You forgot to enter a First Paragraph.'; } else { $first_para = escape_data($_POST['first_para']); } and this: $query = "INSERT INTO blogb (date2, heading, category_id, first_para, entry, more) VALUES ('$date2', '$heading', '$category_id', '$first_para', '$entry', '$more')"; $result = @mysql_query ($query); // Run the query. if ($result) { // If it ran OK. No errors so no idea why it doesn't insert category_id into the database. I put this in my script: ini_set ("display_errors", "1"); error_reporting(E_ALL); And there is nothing in the error log on the server. Please help. Cheers, Colin Quote Link to comment Share on other sites More sharing options...
camdenite Posted February 11, 2009 Author Share Posted February 11, 2009 I should say that first_para does post but that's in a textarea... Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 11, 2009 Share Posted February 11, 2009 First thing I notice is your html is wrong. You have a closing tag on your textarea Change: <textarea name="first_para" cols="60" rows="6" /></textarea> To: <textarea name="first_para" cols="60" rows="6"></textarea> for a start Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 11, 2009 Share Posted February 11, 2009 Should this: $header = escape_data($_POST['category_id']); not be: $category_id= escape_data($_POST['category_id']); ?????? Quote Link to comment Share on other sites More sharing options...
camdenite Posted February 11, 2009 Author Share Posted February 11, 2009 I'm so thick - I'm surprised my bum doesn't fall off :-\ Thanks Deansatch - that sorted it. And my html. Cheers. 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.