Re: passing parameters to a script doesn't work

From: Date: Tue, 23 Sep 2003 04:34:21 +0000
Subject: Re: passing parameters to a script doesn't work
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-163544@lists.php.net to get a copy of this message
Sol wrote:
Hi, I'm trying to pass parameters to a PHP script and it's not working. Whilst this is the first time I've tried to use this, I'm basically copying an example straight out of a text book and can't understand why this doesn't work. In one script I have a (static) link: http://localhost/text/basic.php?html=basic ATM basic.php looks like this: <?php echo("<html>\n<body>\n<p>html: $html</p>\n</body>\n</html>\n"); ?> Pretty simple? Well it doesn't work. All I get in my browser is: html: The only thing I can think of is that I have "register_globals" switched off in php.ini, but I didn't think that this applied when it came to passing parameters in URLs.
Yes, it does apply. Change $html to $_GET['html'] since you are passing this in the URL. If you were passing via a form post method, you would use $_POST['html'], and you can use $_REQUEST['html'] for either. Look here... http://www.php.net/manual/en/language.variables.external.php

« previous php.general (#163544) next »