The diference between
<?php echo $form_field; ?>
<?php echo $_POST['form_field']; ?>
Is that the first one (essentially) would require register_globals be set to ON, which by default (on current versions) is set to OFF. This means you would be required to use the SECOND method above. Alternateively you can “Initialize” you variables (like those used in your first method) using the “Super Globals” (as in the second method) which would leave you with something like
$form_field = $_POST['form_field'];
And a “Better” Way would be to do some “Checking” first AND provide a default value where needed.
$form_field = !empty($_POST['form_field']) ? $_POST['form_field'] : "" ;
Same thing goes with the “REQUEST” method as well.
The INCLUDE portion should be a matter of where the file resides.
The above uses a “Relative” path, meaning that somefile.php MUST reside in the same folder that it’s being called from. It’s “RELATIVE” to where it’s being called. Likewise
must reside in a folder called “subfolder” in the folder that it’s being called from. If not You get an error.
Sometimes you might have files that can be called from multiple locations in your website and you want to know EXACTLY where it’s from. So you use an ABSOLUTE path
<?php include('/your/root/folder/to/www/server/somefile.php'); ?>
This is from the ROOT of the server. Generally it’s the Operating Systems root and NOT the DOCUMENT root of your webserver.
Lastly , I am not sure if your example of
<?php include('http://www.yourdomain.com/somefile.php'); ?>
would work well at all (if it would even work) as I have never tried it. I suppose it might if you only had PLAIN Text, however pulling a PHP file directly from a webserver, means that all the PHP would be parsed, so if you are passing things that might be PHP code that you expect to be included, it won’t work.
Have a look at http://us2.php.net/register_globals for more info on REGISTER_GLOBALS