Posted by:
c2dan
(---.15-1.cable.virginmedia.com)
> 1) My php code works differently in a php file and
> a php section of a htm file. Is it a standard?
> Should I prefer php files? Or is something wrong
> in my settings?
By default WAMP configures Apache to only parse PHP code within .php files. If so you wish you can modify Apaches configuration to parse PHP code within other files, such as .html
To do so left click WAMP's tray icon and select Apache > httpd.conf. Scroll down to line 386 which should be this line
AddType application/x-httpd-php .php
Add a space after .php and type in .html (or any other file extension for PHP code to be parsed in).
Save the httpd.conf and restart the Apache service.
> 2) If I disable global variables and long arrays
> how can I get the name of the page from a link to
> a php code so that I can use
>
> if ($ID=="main" ){include "../main.php";}
If register_globals is disabled then you need to use the correct superglobal variable for where the variable ($ID) is coming from.
For example if the $ID is coming from the url (as in filenmame.php?ID=somevalue) then use the $_GET superglobal. So rather than using $ID you'd use $_GET['ID'] instead.
Similarly if your variable is the name of a form field you'd use $_POST['ID']
For more info read the PHP documentation about superglobals
[
uk2.php.net]