Blank entries inserted into mysql database
Hi there,
I am getting blank entries in my database from my form, instead of the data entered. The same script works fine on another server, but not on the one i built. The only data making it into the database is the date NOW(). No error is returned. I just end up with a blank entry (row is added). I can add entries to the db from shell prompt fine. And can retrieve the entries with php from my browser. I cannot figure out why my inserts are blank! Suggestions / tips / fixes welcome. Thanks, Karl |
seems we need a bit more information. for example, perhaps a snipet of the code that you are using from the form to insert the data.
|
Form is :
<form action="blackboardpost.php" method="post" enctype="multipart/form-data"> <font size="3"><b>Add Post</b></font></td></tr> <tr><td>Title:</td><td><input type="text" name="name"></td></tr> <tr><td>Message:</td><td> <textarea type="text" name="msg" cols="30" rows="10"></textarea></td></tr> <tr><td colspan=2 align="center"><input type="Submit" value="SUBMIT"> </form> Insert is : $query = "INSERT INTO blackboard (date, name, msg) VALUES (NOW(), '$name', '$msg')"; mysql_query($query); |
Hi
Assuming GLOBAL_VARIABLES=ON in your php.ini, could you try the following INSERT - "INSERT INTO blackboard (date, name, msg) VALUES (NOW(),".$name.",". $msg.")"; regards theN ps: if GLOBAL_VARIABLES=off you could try $_POST[name] etc |
Nice one then.
register_globals is 'off' on my build but 'on' on my webhost. So $_POST works on my server. Now i have to figure out what they are and how to turn them 'on'. Many thanks. |
All times are GMT -5. The time now is 01:32 AM. |