PHP - include file with POST data

ajax, include, jquery, php, post

Solution

The `$_POST` superglobal array is writeable in a PHP script, so:

<?php

$_POST["key"] = "value";
include("myfile.php");

?>

Problem

I have a PHP file which takes POST data. I run this file currently through AJAX in jQuery: ``` $.post("myfile.php", { key: value }); ``` I want to run this same file but within another PHP script. This is what I want to achieve: ``` <?php include("myfile.php", array("key" => "value") ); ?> ``` I know that the `include` function doesn't take other parameters, so is there a way to include another PHP file with POST variables?

Original source