Re: Message check then post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



George-

Without seeing your code it's hard to say what the problem is. There could be a typo, a missing quote or semi colon. The code snippet of the review page would be helpful.

Now when you say it's entering "blanks" into the database, I'm assuming you have a messageID field in the db that auto increments in some way, and that you're seeing a new messageID generated and the remaining fields are blank? If that's the case perhaps you're delcaring those variables without data some where in your script. I would need to see your code in order to tell you better.

Assuming everything is good, you need to pass your data from the check message page to your submit page by POST so hidden fields would be good. I'm also noticing that you're not escaping your data before you insert it into the database. This could be bad as quotations, apostrophes, and the such will cause your insert command to fail. Try this:

$username=mysql_escape_string($username);
$name=mysql_escape_string($name);
$message=mysql_escape_string($message);

mysql_query("INSERT INTO forum (user,name,message) VALUES ('$username', '$name', '$message')") or die("Insert Failed");

You should have some debuging built into your script so you can see where it errors out. Have you watched your mysql log file to see what happens during your query? Do you actaully the query happen in the log file? Or do you not have access to it?

Posting your code and any errors would help us figure out what the real problem is.

George B wrote:

I am coding a message board. I am about done. I have all the forms needed for the message. So it all works out. The user types in his name, message title, and the message itself. Then clicks submit. The Submit button takes him to the message check. The message check shows all the stuff the user entered. Then it has "echo" which says 'Is this correct'? And then there is a button. "Yes" When the user clicks yes it goes to another PHP file which runs the SQL query to put in the entereddata into the database $query = "INSERT INTO forum (user,name,message) VALUES ('$username','$name','$message')";
$result = mysql_query($query);

But see, the problem is that it is entering blanks into the DB. I think that is because the $username $name and $message are in the other file? I have no idea how to by-pass this problem. What should I do?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux