I would like to ask for some help with the following please. The error I am getting is:
Warning: Cannot modify header information - headers already sent by
This is the code I am using:
<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true)
{
echo 'Your details have been updated!';
}
else
{
if (empty($_POST) === false && empty($errors) === true)
{
$newevent = array(
'title' => $_POST['title'],
'discription' => $_POST['discription'],
'event_date' => $_POST['event_date'],
'time' => $_POST['time'],
'contact_name' => $_POST['contact_name'],
'contact_num' => $_POST['contact_num'],
'username' => $_POST['username']
);
new_event($session_user_id, $newevent);
header('Location: settings.php?success');
exit();
} else if (empty($errors) === false) {
echo output_errors($errors);
}
}
?>
and this is the new_event function:
function new_event($user_id, $newevent) {
$event = array();
array_walk($newevent, 'array_sanitize');
foreach($newevent as $field=>$data) {
$event[] = '`' . $field . '` = \'' . $data . '\'';
}
mysql_query("UPDATE `event` SET " . implode(', ', $event) . " WHERE `username` = $user_id");
}
Any assistance would be much appreciated, I've been looking over it for ages.
Many thanks