Re: New PHP User with a simple question

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

 



2009/1/24 Christopher W <cweibel@xxxxxxxxxxxx>:
> At least I hope it is simple...
>
> I am trying to get an HTML menu link to set a variable's value.  For
> example, when a user clicks the "Home" button on my page it would cause
> $page = "home"; or clicking the "About Us" button will set $page="about_us";
> etc.
>
> I think this should be fairly simple but being completely new to php I just
> cannot seem to get it right.
>
> Any help would be greatly appreciate.
>
> Thank you in advance.

Hi there,

A good way to increase your chance of getting a useful response is to
post the smallest example you can which clearly illustrates the
problem you're having. In this case, you say you're not able to get
this to work, but we could waste quite a bit of time trying to guess
what you've tried and what didn't work.

In the simplest case, you could make your menu items look something
like this: <a href="target.html?page=home">Home</a> and then use $page
= $_GET['page'] in your script, but I wouldn't recommend it since now
you have user data floating around in your script and it will later
become a pain in the butt to sanitize for security. For a learning
script it'll be fine though.


Torben

-- 
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