isset() doesn't work in WAMP5
Posted by: wuffy77 (84.13.241.---)
Date: April 19, 2007 11:07PM

Hi there,

I'm trying to learn php using WAMP, but a lot of the times when I think I must be doing something wrong, it seems to be WAMP winding me up!

I've got the following code:
<a href="phptest1.php?live=Yes"> Page Status Live = <?php if (isset($live)) { echo $live; } else { echo "No"; } ?></a>

This is supposed to give a status on "no" and then when you click the link it changes to "Yes" - however nothing happens.

My previous php script worked fine - is there anything I need to set on WAMP to get it to work?

Options: ReplyQuote
Re: isset() doesn't work in WAMP5
Posted by: tamicsko (---.net-tv.hu)
Date: April 20, 2007 09:20AM

Hi!

Sorry for my bad english tongue sticking out smiley

The webserver dosen't parse automatically HTTP request parameters - like in your sample code live - into php variables. This has a security and clear coding reasons ( or not? smiling smiley ).

Yoy have two choices:

1. turn on the register_globals parameter in php.ini. Click on wamp taskbar icon to edit this config file

2. Access your http reguest parameters via $_REQUEST array.

My advice is to use the second one. You will finde your live parameter like this:
$live = $_REQUEST['live'];

Options: ReplyQuote
Re: isset() doesn't work in WAMP5
Posted by: CyberSpatium (71.237.217.---)
Date: April 20, 2007 08:29PM

DO NOT turn on register globals in your php.ini file. this is a HUGE security risk. that is why the php community disabled it by default in php 4.2.x.

you need to learn how to develop scripts with it disabled, as most web hosts have it disabled.

also, using $_REQUREST is a huge security issue too. you should use $_GET or $_POST instead. and make sure you verify all user submitted data to protect your scripts from sql injections, cross site scripting, etc.

see ereg, preg_match and also preg_replace.

[www.php.net]
[www.php.net]
[www.php.net]


CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!

Please visit my latest website Clarify Loans:
clarifyloans.com

Options: ReplyQuote


Sorry, only registered users may post in this forum.