Edit:
To clarify. include/require just read the file from the file system. The contents of the file is parsed as php code (if it's inside php opening and closing tags - just like for any other php script). They have nothing to do with a get or post request to a web server.
thelos999;10989852 wrote:
include "/Applications/MAMP/htdocs/Homework/Advanced/LittleSprout/edit.php?id=" . $POST['id'];
So you have the id in $_POST['id']. You want to include more code in a separate file.
# $_POST['id'] contains id allready
echo $_POST['id'];
function someFunc()
{
echo "I'm func!";
}
include 'somefile.php';
Why do you expect somefile.php to NOT have access to everything else that exist when that piece of code is included?
somefile.php
# should this fail?
echo $_POST['id'];
# should this fail?
someFunc();
Like I said before (without link), read up on scope. And read up on [man]include[/man]/[man]require[/man].
If you on the other hand want the user to be able to request a new page and pass on the id, then you might want to do something like
printf('<a href="%url?id=%d">Edit %d</a>', $url, $_POST['id'], $_POST['id']);
or
header(sprintf('location: http://%s?id=%d', $url, $_POST['id']));