Attributes construct error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Attributes construct error

Post by seandisanti » Mon Feb 11, 2013 11:07 pm

i typically use a ternary operator in situations like this. try:

Code: Select all

<option value="2011" <?php echo ($_POST['report_year']==2011)?'selected="selected":'' ?>>2011</option>

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 6 guests