Checkbox To Send Email In Form

I am trying to save a value from a form , somewhat unsuccessfully and I am struggling to find out what i am doing wrong.

Here’s the scenario

I have a form that posts a new job to the database, I have a checkbox within that called ‘email_cust’, which when checked should send an email to the customer letting them know a job has been created,

the code in the view is

<?php echo $form->labelEx($model,‘email_cust’); ?>

<?php echo $form->checkBox($model,‘email_cust’, array(‘value’=>1, ‘uncheckValue’=>0)); ?>

and in my controller i am trying to do

if ($model->email_cust == 1) {

&#036;mail = new YiiMailer();


&#036;mail-&gt;setFrom('support@mydomain.co.uk', 'My comapany ');


&#036;mail-&gt;setTo(&#036;model-&gt;customer-&gt;email);


&#036;mail-&gt;setSubject('test');


&#036;mail-&gt;setBody('test');


&#036;mail-&gt;send();

}

i have a public variable in the model called $email_cust and it is set to safe

any ideas as to why this is not working, or am i going about it the wrong way ?

Hi,

you can try this


if ($model->email_cust == '1') {

}

hope it’s working

That was it thankyou very much