[eluser]NateL[/eluser]
Does it go against the MVC architecture if I run if statements inside my view file?
I have a form that displays an animals gender. Male/Female/Unknown.
When someone edits an animal, I need the appropriate radio button to be checked, so here's how I've done it:
Code:
<p><label>Sex</label><br />
<input type="radio" name="sex" value="Male" <?php if ($animal->sex == 'Male'){echo "checked=\"checked\"";}?> />Male<br />
<input type="radio" name="sex" value="Female" <?php if ($animal->sex == 'Female'){echo "checked=\"checked\"";}?> />Female<br />
<input type="radio" name="sex" value="Unknown" <?php if ($animal->sex == 'Unknown'){echo "checked=\"checked\"";}?> />Unknown<br />
</p>
Like I said...It works, but does it go against the MVC architecture? and is there possibly a better way to determine which option is checked in my model or controller?
Thanks