Hi Chris,

Thanks for the pointer :) I found some other interesting reference and ideas
on using this in the manual. Now I just need to provide some error checking
in case $_GET['menu'] isn't defined in the URL (that should be pretty
straight fwd) and in case it is defined, but a corresponding image doesn't
exist (in this case because a user could potentially add a menu item to the
db for which there is no pre-existing graphic). That might prove a little
tougher. I guess I could define an array of available images and check
$_GET['menu'] against that, and specify a default if there isn't a match.

Cheers,
Verdon


On 3/13/03 4:10 PM, "Chris Hayes" <[EMAIL PROTECTED]> wrote:

> To read the value of menu in the url, do not use 'menu', but use
> $_GET['menu']      (since PHP 4.1.0)
> 
> To check for '2*' you cannot do what you propose.
> Because PHP is such a friendly language with 'types' you could use a string
> function to pick the first character
> 
> $img_pick=subtr($_GET['menu'],0,1);
> (check the manual on substr() to be sure, in the online manual on www.php.net)
> 
> The maximum of numbers is 10 (0-9), so you may want to just make a separate
> value in the url for this.
> 
> I thionk you can omit the if-list now.
> 
> 
> 
>> echo = "<img src=\"foo_$imgNo.jpg\">";
> 
> 
> 
> At 21:55 13-3-2003, you wrote:
> 
>> mod.php?mod=userpage&menu=215&page_id=xxx
>> mod.php?mod=userpage&menu=20001&page_id=xxx
>> mod.php?mod=site_map&menu=20010
>> 
>> And would want all the following pages to load an image named something like
>> foo_1.jgp
>> mod.php?mod=userpage&menu=1&page_id=xxx
>> submit.php&menu=100
>> mod.php?mod=userpage&menu=10002&page_id=xxx
>> 
>> In all cases, I know for sure that in the URL I will find menu=x*
>> 
>> Can I set something up like;
>> 
>> if(menu = '2*') { $ImgNo = '2'; }
>> if(menu = '1*') { $ImgNo = '1'; }
>> if(menu = '') { $ImgNo = '3'; }


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

Reply via email to