0

I have a problem with this statement:

header("Location: $_SERVER[HTTP_REFERER]");

I am getting the following error:

Syntax error: unexpected 'location(T_STRING)' This is the php file:

foreach($_POST['mentalState'] as $mentalState)
($mentalState1=$mentalState . ',' . $mentalState1);

}
else{

    $mentalState1="no information";
}


if(!empty($_POST['mentalState2'])){
// Loop to store and display values of individual checked checkbox.
foreach($_POST['mentalState2'] as $mentalState)
($mentalState2=$mentalState . ',' . $mentalState2);
}

else{

    $mentalState2="no information";
}


if(isset($mentalState1) && isset($_POST['action']) && isset($mentalState2)) {
    $data = $mentalState1 . '-' . $_POST['action'] . '-' . $mentalState2 . "\n;
    $ret = file_put_contents('matrix.txt', $data, FILE_APPEND | LOCK_EX);
    if($ret === false) {
        die('There was an error writing this file');
    }

  else {
  header("Location: $_SERVER[HTTP_REFERER]");
}
}

else {
   die('no post data to process');
}

}

p.s. I am working on cloud9 p.s.2 I tried to look up for existing answers but non of them seems to work for me.

janeloulou
  • 17
  • 5

0 Answers0