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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.