Hi there!

I've got some strange problems whilst passing variables from forms into my
php-script. When I use IE5 it works like a charm. Using Opera or IE4* the
referred "action" script crashes due to memory restrictions on the server,
in a function I use to get all the dates between two given dates, presumably
due to my while condition never turning false. This lead me to believe that
my variables were being gargled in some way as to make the parsing fail,
this is however not the case as far as I can tell.

This is the function I use to retrieve all the dates inbetween $from and $to
inclusive (yes, it's butt ugly, I know, but I'm in kinda of a hurry, my
deadline is approaching ;) :

/*
 Function geDates(from, to) takes strings containing dates in the form
"YYYY-MM-DD"
    and returns an array containing the dates between "from" and "to"
inclusive
*/

function getDates($from, $to) {
 (int) $year=substr($from,0,4)+0; /* Adding the zero is a kluge  to force
away leading zeros */
 (int) $month=substr($from,5,2)+0;

 (int) $day=substr($from,8,2)+0;

 $datearray[0]=$from;
 $current=$from;
 while($current!=$to) {
  $day=$day+1;
  if(checkdate($month, $day, $year)) {
   $current=zeroPadDate($year, $month, $day);
   $datearray[]=$current;
  } else {
   $month=$month+1;
   $day=1;
   if (checkdate($month, $day, $year)) {
    $current=zeroPadDate($year, $month, $day);
    $datearray[]=$current;
   } else {
    $year=$year+1;
    $month=1;
    $current=zeroPadDate($year, $month, $day);
    $datearray[]=$current;
   }
  }

 }
 return $datearray;
}

/* Accessory function to getDates above.  */

function zeroPadDate($year, $month, $day) {
 if ($month<10) $mstr="0$month";
 if ($day<10) $dstr="0$day";
 return "$year-$mstr-$dstr";
}

What could it possibly be due to? Are there any differencies in the way the
above mentioned browsers pass the form variables?

If you do find it in your heart to help me out with this one, please also
reply by e-mail to [EMAIL PROTECTED]

Thanks in advance,

Claes Andersson
Webmaster, www.palladiumbio.com

PS Exchanging "GET" and "POST" in the referring form made no difference in
the world DS




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