i need to store the date as $day, $month, $year and then build it into some
selectors when a user returns to the page. so they chhose a date and it
stays constant as they move around the site. i have a department id that
does the same and i've duplicated the code for day, month, year etc and it
simply doesn't work.

it works when i refresh the page but not when i go to another page and then
back again.

this is the bit that sets the sessions vars whihc is on a page called
login2, which deals with the login stuff (strangely enough :-)


then in the department calendar i have ....

if (isset($cday))
                $day = intval($cday);

if (isset($cmonth))
                $month = intval($cmonth);


if (isset($cyear))
                $year = intval($cyear);


// date option drop downs
if ( (!checkdate($month, $day, $year)) || (isset($today)) )
        print "if !checkdate fired";
        $nowArray = getdate();
        $cday = $nowArray[mday];
        $cmonth = $nowArray[mon];
        $cyear = $nowArray[year];

$start = mktime (0, 0, 0, $cmonth, $cday, $cyear );

// date used in adding date lines
$start2 = mktime (0, 0, 0, $cmonth, $cday, $cyear );

$firstDayArray = getdate ($start);

echo '<select name="cday" onChange="document.thisForm.submit()">';
for ($x=1; $x<=31; $x++)
        if (checkdate($cmonth, $x, $cyear)) // add if valid day number for
        print "<option value=".$x;
        //print $x.date(S);
        print ($x == intval($cday)) ? " SELECTED":"";
        print ">".$x;
print "</select>";

echo '<select name="cmonth" onChange="document.thisForm.submit()">';
$months = Array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");

for ($x=1; $x <= count($months); $x++)
        print "\t<option value=\"$x\" ";
        print ($x == intval($cmonth)) ? " SELECTED":" ";
        print ">".$months[$x-1]."\n";
echo ' </select> ';

echo '<select name="cyear" onChange="document.thisForm.submit()">';
for ($x=1998; $x<2004; $x++)
        print "\t<option";
        print ($x == intval($cyear)) ? " SELECTED":" ";
        print ">$x\n";
echo ' </select> ';
echo '';

echo '<input type="submit" name="today" value="Today">';

--- sorry abouyt the log paste ...

ok. this is what happens.
when the user clicks today the date is set to todays. this works.
when they choose a day, month or year the form refreshes and shows the
correct calendar info. this works.

when they go to another page and then back again, the calendar defaults back
to todays date. i need the date to be the same as it was when they left the

i've been staring at it for 2 hours now ...

Steve Brett 
Internal Development 
EMIS Ltd. 
"Privileged and /or Confidential information may be contained in this
message. If you are not the original addressee indicated in this message (or
responsible for delivery of the message to such person), you may not copy or
deliver this message to anyone. In such case, please delete this message,
and notify us immediately. Opinions, conclusions and other information
expressed in this message are not given or endorsed by my firm or employer
unless otherwise indicated by an authorised representative independently of
this message."
Egton Medical Information Systems Limited. Registered in England. No
Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth,
Leeds, LS18 4RF

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to