undefined variable in model on server but not locally

Having a strange problem

I want to add a variable to my model but it’s giving me some errors

this is my class in model/VolunteerForm.php





class VolunteerForm extends CFormModel

{

	public $name;

	public $email;

	public $subject;

	public $body;

	public $verifyCode;

        public $special;   // THIS DOES NOT WORK???

	public $type;

	public $day1;

        public $day2;

        public $day3;

        public $day4;

        public $day5;

        public $day6;

        public $day7; 


	/**

	 * Declares the validation rules.

	 */

	public function rules()

	{

		return array(

			// name, email, subject and body are required

			array('name, email, subject, body, type', 'required'),

                        array('special', 'safe'),

			array('day1, day2, day3, day4, day5, day6, day7', 'numerical', 'integerOnly'=>true),

			// email has to be a valid email address

			array('email', 'email'),

			// verifyCode needs to be entered correctly

			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),

		);

	}




	

}




and in siteController.php





public function actionVolunteer()

	{

		

		$model=new VolunteerForm;

		

	    $model->special = Yii::t('general','If you have any special skills enter them here (i.e. First aid, First responder, etc)');

		//$model->special = 0;

		

		$model->day1 = 0;

		$model->day2 = 0;

		$model->day3 = 0;

		$model->day4 = 0;

		$model->day5 = 0;

		$model->day6 = 0;

		$model->day7 = 0;

		$model->special = "some text";

		if(isset($_POST['VolunteerForm']))

		{

			$model->attributes=$_POST['VolunteerForm'];

			if($model->validate())

			{

				$model->sendEmail($model);

				Yii::app()->user->setFlash('volunteer',Yii::t('content','Thank you for contacting us. We will respond to you as soon as possible.'));

				$this->refresh();

			}

		}

		$this->render('volunteer',array('model'=>$model));

	}




then I call it from my view in view/site/volunteer.php

the form worked great until I added the variable "special". For some reason it keeps telling me that VolunteerForm.special is not defined! This only happens when I load onto the server. When I try locally it works as I would expect.

am I missing something? should that be declared elsewhere?

It is because you defined the $special property in the VolunteerForm class which extends CFormModel class.

But for DB operations (queries and CRUD) you need to extend CActiveRecord class

it’s not linked to DB… .it’s just for form (like the contact u s form)

I added the day1, day 2 , etc with no problems… .not sure why special is causing this behavior

Sorry, my bad, I guess I have beergoggles.

so…no idea what would cause that eh? it works locally …just uploaded my files again and same thing

this is driving me nuts!

Is your server caching?

maybe… how would I know this?

Hmm, maybe by writing


<php phpinfo();

in a file named phpinfo.php (just an example name) and then check that file over http://localhost/phpinfo.php?

pretty much the same…does not seem to be the problem

fixed!!!

the code was fine…

it didn’t like the Upper case letters!

changed my model to volunteerform and it solved the problem! i’ve had this happen to me before…

strange thing is that some other files like SiteControler work file despite the upper case in the S… not sure why this time around it created that problem

Oh, so you had siteController instead of SiteController?

And you develop on Windows machine and upload to Linux server?

I develop on a Mac and the servers are running on FreeBSD or CentOS from what their site says