MySQL & PHP Use of Undefined Constant

Posted by Nik on Stack Overflow See other posts from Stack Overflow or by Nik
Published on 2010-05-31T03:07:15Z Indexed on 2010/05/31 3:12 UTC
Read the original article Hit count: 294

Filed under:
|
|
|
|

Alright, PHP is throwing this error (only in the logs):

Error

PHP Notice:  Use of undefined constant department - assumed 'department' (line 5)
PHP Notice:  Use of undefined constant name - assumed 'name' (line 6)
PHP Notice:  Use of undefined constant email - assumed 'email' (line 7)
PHP Notice:  Use of undefined constant message - assumed 'message' (line 8)

Lines 4-7

$department = mysql_real_escape_string($_POST[department]);
$name = mysql_real_escape_string($_POST[name]);
$email = mysql_real_escape_string($_POST[email]);
$message = mysql_real_escape_string($_POST[message]);

I think it has something to do with defining constants before defining them (how is this possible).

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php5