Jump to content

unexpected t_IF


etsted

Recommended Posts

this code generates unexpecteT_IF

 

echo " <form> <select name='mnd'> <option value='jan'>jan</option> <option value='feb'>feb</option> <option value='mar'>mar</option> <option value='Apr' " . if($dagen_mnd == 'Apr'){echo "selected='selected'";} . ">Apr</option> </select> </form>";

Link to comment
Share on other sites

An if statement does not belong inside an echo statement, an if statement does not return or evaluate to a value.

echo "    <form>        <select name='mnd'>            <option value='jan'>jan</option>            <option value='feb'>feb</option>            <option value='mar'>mar</option>            <option value='Apr'  " . ($dagen_mnd == 'Apr' ? 'selected="selected"' : '') . ">Apr</option>        </select>    </form>";
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...