dca_steve Posted February 8, 2013 Share Posted February 8, 2013 Hi everyone....can't seem to figure this one out. I don't see what is wrong with line 220....I've tried removing the spaces thereby running everything together, tried removing some of the spaces (i.e. the space between "2011" and <?php) among various other combinations of spacing, still get these errors.....don't see any unclosed/unresolved ending tags..... 220 attributes construct error [XHTML 1.0 Strict] 220 Couldn't find end of Start Tag option line 220 [XHTML 1.0 Strict] 220 Opening and Ending tag mismatch: select line 218 and option [XHTML 1.0 Strict] 222 Opening and Ending tag mismatch: div line 216 and select [XHTML 1.0 Strict] Here is the code: 216 <div class="content_onecolumn"> 217 <label for="report_year" class="long"><span style="font-weight:bold">1.</span> Report for Year:</label> 218 <select name="report_year" id="report_year" class="selectTwo"> 219 <option value="" selected="selected">*Select the Year*</option> 220 <option value="2011" <?php if($_POST['report_year'] == 2011) echo 'selected';?>>2011</option> 221 </select> 222 </div> Any ideas? Thanks - Steve Any ideas? Quote Link to comment Share on other sites More sharing options...
requinix Posted February 8, 2013 Share Posted February 8, 2013 if($_POST['report_year'] == 2011) echo 'selected'; You're validating as XHTML so you have to use the full name="value" form for attributes. Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted February 9, 2013 Share Posted February 9, 2013 (edited) Try: echo "selected='selected'"; and if you want to use double quotes for the attributes, just escape the two nested double quotes with a backslash. Regards, L2c. Edited February 9, 2013 by Love2c0de Quote Link to comment Share on other sites More sharing options...
dca_steve Posted February 12, 2013 Author Share Posted February 12, 2013 Hi all - thanks for the replies. Still haven't gotten it to work, I get the same errors. I've tried various combinations including the following: Tried this first.... <option value="2011" <?php if($_POST['report_year'] == 2011) { echo 'selected="selected"'; } ?>>2011</option> Then this.... <option value="2011" <?php if($_POST['report_year'] == 2011) { echo "selected='selected'"; } ?>>2011</option> Then this.... <option value="2011" <?php if($_POST['report_year'] == 2011) echo 'selected="selected"'; ?>>2011</option> Lastly this.... <option value="2011" <?php if($_POST['report_year'] == 2011) echo "selected='selected'"; ?>>2011</option> Not sure where to go from here! Quote Link to comment Share on other sites More sharing options...
requinix Posted February 12, 2013 Share Posted February 12, 2013 (edited) ...Are you running the PHP source through the validator? What is the full document? Maybe there's an error somewhere else causing this. Edited February 12, 2013 by requinix 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.