Re: PHP URL query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/10/06, IraqiGeek <geek@xxxxxxxxxxxxx> wrote:
Hi all,

I'm somewhat new to php, though I have played a bit with the language. I'm
currently learning the language, and I'm having a problem passing variables
through "URL query". Here is what I have:

A simple HTML file that contains:
<A HREF="test.php?var=test"> Hi, this is a test! </A>

and a php file that contains:
<?php
echo( "Welcome to our Web site, $var!" );
?>

However, when I click on the link on the HTML file, I dont get the value of
$var passed to the php script. I have also tried passing multiple variables
separated by &, and none of those gets passed to the php script.

The files are hosted on a local Debian etch server running apache 2.0.54 and
php 4.3.10.

Is there something I need to check/change in the config files of apache or
php?


Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Try $_GET['var'].

echo( "Welcome to our Web site, {$_GET['var']}!" );

Two things you should note:
- using $var would be using register_globals which is depricated.
(http://us2.php.net/register_globals)
- echoing out get variables can lead to a XSS attack. (read
http://ha.ckers.org/xss.html)

As many like to point out, please read http://phpsec.org/ for some
security articles since most tutorials always strip any security
related code for simplicity.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux