send post data


How do I send Post data? This didnt work as the data doesnt get picked up with Post

 header("location:checkreg.php?myusername=" . $myusername . "&mypassword=" . $mypassword ."&mysurname=" . $mysurname . "&myfirstname=" . $myfirstname . "");


Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Not in "$_POST" but it would be there for $_GET.  $_GET is the query string info in a URL.

Marco GasiFreelancerCommented:
You can't use header to pass post data or parameters ( You should put them in a session (




And in checkreg.php:


That's all
Ray PaseurCommented:
Please show us the script that you're using to send the post data.  If you've got an HTML form, it should be easy to give you a tested and working example.

Jagadishwor DulalBraces MediaCommented:
If you are posting data using form then why do you need header location redirect you can add action in form.
Julian HansenCommented:
Why do you want to post on a redirect?

Two options - if you have to post then create a dummy page with a form and the vars you want posted with some javascript to auto submit the form. Clumsy but then you are not doing something generally considered normal.

Failing that - you can use the $_SESSION to save the vars before doing a standard header redirect to the target page - which can then pull the values it needs from the session.

All of this is up in the air though - without knowing what you are trying to do the correct solution might be something else completely - such as using CURL or similar.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.