Posted by Troy Piggins on 01/03/07 00:47
* Ric wrote:
> Troy Piggins schrieb:
>> I have a php page[1] with 'includes'[2]. The page correctly
>> displays a calendar of the current month and current year if
>> $Month and $Year are not assigned, but if I try to call the page
>> with blog.php?Month=12&Year=2006 in the URL nothing seems to
>> change. Any ideas?
>
> Yes it is because you never get these parameters, see below:
>
>> [1] blog.php
>> [snip html headers etc]
>> <?php
>> $Title= "Blog";
>> include( "calendar.php");
>> ?>
>> [snip body and footers etc]
>>
>> [2] calendar.php
>> <?php
>>
>> if( !$Month) $Month= date( "m");
>> if( !$Year) $Year= date( "Y");
>
> if(isset($_GET['Month']){
> $Month = $_GET['Month'];
> }
>
> I prefer this version:
>
> isset($_GET["Month"]) ? $Month = $_GET["Month"] : $Month = "";
>
> Same for Year.
>
> [---=| TOFU protection by t-prot: 42 lines snipped |=---]
Thanks for that - I'll look into it.
--
Troy Piggins ,-O (o- O All your sigs are belong to us.
http://piggo.com/~troy O ) //\ O
RLU#415538 `-O V_/_ OOO
hackerkey://v3sw5HPUhw5ln4pr6OSck1ma9u6LwXm5l6Di2e6t5MGSRb8OTen4g7OPa3Xs7MIr8p7
Navigation:
[Reply to this message]
|