Jump to content

Need to make this class work in PHP4


lowe_22

Recommended Posts

Hi,

 

I have recently written this class to create drop down select boxes using PHP 5.

I then discovered that my webhost runs only PHP4. The probelm is, I dont' know the differences between PHP4 and PHP5 thus I have no idea how to get this class working in PHP4!

 

If anyone has any ideas, please do let me know! Code below.

 

<?php

//Define Dates
class DateViewHelper {

static $MONTHS = array(
"January", "Febreuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
		    );
satic $DAYS = array(
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");


static function yearPulldown ($from, $to, $selected ){
	$ret = "";

	for ( $x = $from; $x <= $to; $x++ ) {
		$ret .= "<option";
		$ret .= ($x == $selected )?' selected="selected"':"";
		$ret .= ">$x</option>\n";
	}
	return $ret;
}

static function monthPulldown( $selected ) {
	for ( $x=1; $x <= 12; $x++ ) {
		$ret .= "<option value=\"$x\"";
		$ret .= ( dateViewHelper::$MONTHS[$x-1] == $selected )?' selected="selected"':"";
		$ret .= ">".dateViewHelper::$MONTHS[$x-1]."</option>\n";
		}
	return $ret;

}

static function dayPulldown ( $selected ) {
	for ( $x=1; $x <= 31; $x++ ) {
		$ret .= "<option value=\"$x\"";
		$ret .= ($x == $selected )?' selected="selected"':"";
		$ret .= ">$x</option>\n";
		}
	return $ret;
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/
Share on other sites

While this won't directly solve your problem, the end of life of php4 has already gone past. The final bug fixes were released on Jan 3, 2008 and support for it will stop on Aug 8, 2008. It is an obsolete product.

 

Your web host should have php5 available, either through your control panel or a .htaccess file setting or they should have a specific schedule for switching to php5. Check with them on how to select php5 or when they expect to provide it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.