[PHP] Passage de variables dans l'URL impossible ???

Passage de variables dans l'URL impossible ??? [PHP] - PHP - Programmation

Marsh Posté le 09-01-2003 à 19:27:20    

Bonsoir,
 
 
Voilà je débute en php et j'ai un petit problème avec le passage de variables dans l'URL.
 
J'ai le code suivant :
 

Code :
  1. <?
  2. echo "toto vaut $toto";
  3. ?>


 
Si je tape dans Netscape :
http://localhost/~johndoe/test.php?toto=5
 
J'ai juste "toto vaut" qui s'affiche dans la fenêtre (au lieu de "toto vaut 5" ).
 
Je m'y prends mal ?  
 
Merci d'avance,
Un phpéteux qui a du mal.
 
 
 

Reply

Marsh Posté le 09-01-2003 à 19:27:20   

Reply

Marsh Posté le 09-01-2003 à 19:33:04    

External variables are no longer registered in the global scope by default. In other words, as of PHP 4.2.0 the PHP directive register_globals is off by default in php.ini. The preferred method of accessing these values is via the autoglobal arrays mentioned above. Older scripts, books, and tutorials may rely on this directive being on. If on, for example, one could use $id from the URL http://www.example.com/foo.php?id=42. Whether on or off, $_GET['id'] is available.  
 
http://www.php.net/manual/en/tutorial.oldcode.php
 
http://www.php.net/manual/en/langu [...] efined.php
 

Reply

Marsh Posté le 09-01-2003 à 20:02:45    

beleg a écrit :

External variables are no longer registered in the global scope by default. In other words, as of PHP 4.2.0 the PHP directive register_globals is off by default in php.ini. The preferred method of accessing these values is via the autoglobal arrays mentioned above. Older scripts, books, and tutorials may rely on this directive being on. If on, for example, one could use $id from the URL http://www.example.com/foo.php?id=42. Whether on or off, $_GET['id'] is available.  
 
http://www.php.net/manual/en/tutorial.oldcode.php
 
http://www.php.net/manual/en/langu [...] efined.php
 
 


 
Thanks a lot  :)

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed