Can't make php conditional “if” work inside HTML

my code is the following;

            <select class="reg_field_field" id="user_address_state" name="user_address_state" tabindex="7">
                <option value="AL" <?php if($state=='AL') echo 'selected';?>/>Alabama</option>
                <option value="AK" <?php if($state=='AK') echo 'selected';?>/>Alaska</option>
                <option value="AZ" <?php if($state=='AZ') echo 'selected';?>/>Arizona</option>
         ....       
            </select>

And the result is showing me instead the state name, it show "Notice: Undefined variable...".

I tried this in other server and worked, could be the php.ini configuration??? What can be on php.ini?

Thank you for any help

Ale

0
задан Tony 23 February 2012 в 20:27
поделиться