LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Blank entries inserted into mysql database (https://www.linuxquestions.org/questions/programming-9/blank-entries-inserted-into-mysql-database-94672/)

sandoz 09-19-2003 07:45 PM

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

guild 09-19-2003 08:29 PM

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.

sandoz 09-20-2003 06:09 AM

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);

then 09-21-2003 04:17 AM

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

sandoz 09-22-2003 03:51 AM

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.