3 small PHP errors I cannot decipher

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2012-11-02T04:53:44Z Indexed on 2012/11/02 5:00 UTC
Read the original article Hit count: 144

Filed under:
|

*Notice: Use of undefined constant _ - assumed '_' in /.../uploader.php on line 45*

Line 45

$newname = str_replace(array(' ', '&'), array('_', 'and'), trim( strip_tags( $_POST['name'] ) ) ) . _ . $formKey->generateKey() . '_' . time() . '.jpg';

Notice: Undefined index: approve in /.../uploader.php on line 81

Line 81 - the second last line here

    $query = sprintf("INSERT INTO `$db_name`.`the_table` (`id` , `name` , `photo` , `email` , `date` , `code` , `subscribe` , `approve` , `created` )
        VALUES ( NULL , '%s', '%s', '%s', '%s', '%s', '%s', '1', CURRENT_TIMESTAMP );",
        mysql_real_escape_string($_POST['name']),
        mysql_real_escape_string($newname),
        mysql_real_escape_string($_POST['email']),
        mysql_real_escape_string($date),
        mysql_real_escape_string($_POST['code']),
        mysql_real_escape_string($subscribe),
        mysql_real_escape_string($_POST['approve'])
        );

Warning: Cannot modify header information - headers already sent by (output started at /.../uploader.php:45) in/.../uploader.php on line 102

Line 45

$newname = str_replace(array(' ', '&'), array('_', 'and'), trim( strip_tags( $_POST['name'] ) ) ) . _ . $formKey->generateKey() . '_' . time() . '.jpg';

Line 102 - the third line here

if ($success == 'Done') {
    $page = 'uploader';
    header('Location: ./thanks.php');
} else {
echo "error";
}

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql