aebstract Posted January 25, 2010 Share Posted January 25, 2010 If I have something like: <option value=\"lalalla.html\">lalalla How can I run a simple if statement in it, roughly like: <option -if ( $var == $anothervar ) { SELECTED }- value=\"lalalla.html\">lalalla Quote Link to comment Share on other sites More sharing options...
schilly Posted January 25, 2010 Share Posted January 25, 2010 you basically got it: <option <?php if ( $var == $anothervar ) { echo "SELECTED=\"SELECTED\" } ?> value=\"lalalla.html\">lalalla Quote Link to comment Share on other sites More sharing options...
aebstract Posted January 25, 2010 Author Share Posted January 25, 2010 xD Thanks Quote Link to comment Share on other sites More sharing options...
schilly Posted January 25, 2010 Share Posted January 25, 2010 oops forgot semi colon <option <?php if ( $var == $anothervar ) { echo "SELECTED=\"SELECTED\"; } ?> value=\"lalalla.html\">lalalla Quote Link to comment Share on other sites More sharing options...
aebstract Posted January 25, 2010 Author Share Posted January 25, 2010 oops forgot semi colon <option <?php if ( $var == $anothervar ) { echo "SELECTED=\"SELECTED\"; } ?> value=\"lalalla.html\">lalalla <option <?php if ( $var == $anothervar ) { echo "SELECTED"; } ?> value=\"lalalla.html\">lalalla actually it'd be like that Just needed the basic though, was stupid to not think of it. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.