Why are POST variables not passed to INCLUDE sections when a full URL, such as "http://www.douglashosting.com/include-detail.php", is used instead of a relative URL, such as "include-detail.php"?
Here is the code:
Source File:
input.html
<form method="POST" action="detail.php">
<input type="hidden" name="RecordNumber" value="3">
<input type="submit" value="View All Images">
</form>
Results Main File:
detail.php
<?
$RecordID=$_POST['RecordNumber'];
echo "Main RecordID=" . $RecordID . "<br />";
?>
<?php include("include-detail.php"); ?>
include-detail.php file:
<?php
echo "Include RecordID=" . $RecordID . "<br />";
?>
Displayed Results:
Main RecordID=3
Include RecordID=3
Now here is the change in the detail.php page that fails.
Modified Results Main File:
detail.php
<?
$RecordID=$_POST['RecordNumber'];
echo "Main RecordID=" . $RecordID . "<br />";
?>
<?php include("http://www.douglashosting.com/include-detail.php"); ?>
Displayed Results:
Main RecordID=3
Include RecordID=
As you can see, when the full URL "http://www.douglashosting.com/include-detail.php" is used, the $RecordID variable is not retained.
I even tried re-initializing the variable in the include-detail.php page.
Modified include-detail.php file:
<?php
$RecordID=$_POST['RecordNumber'];
echo "Include RecordID=" . $RecordID . "<br />";
?>
Displayed Results:
Main RecordID=3
Include RecordID=
Again, the results are the same.
Can anyone explain why this happens?
Thanks.