PHP: How do I have a variable hhtp-header value for my GET request?

Posted by Cortopasta on Stack Overflow See other posts from Stack Overflow or by Cortopasta
Published on 2010-06-07T16:23:11Z Indexed on 2010/06/07 16:32 UTC
Read the original article Hit count: 241

Filed under:
|

I want the user to submit an answer to a question, then upon submission be redirected back to the page where they asked the question and I can't seem to get this to work:

if (!isset($_POST['answer']) && !isset($_POST['verse']))
  {
  echo "Please fill out form.";
  }
elseif (!isset($_POST['answer']) || !isset($_POST['verse']))
  {
  echo "one field left blank";
  }
else
  {
  $user->submitAnswer($question_id);
  header("Location: welcome.php?question_id=$question_id");
  exit;
  }

What am I doing wrong?

EDIT: Sorry, wasn't very clear. I'm trying to pass the variable $question_id to the header(location: part so that it will pull up the question they were just on and show the answer they posted

© Stack Overflow or respective owner

Related posts about php

Related posts about http-header-fields