Guest upirate Posted March 8, 2007 Share Posted March 8, 2007 $resultsperpage="<form name='form1' method='post' action='something.php'> <label> Results per page <select name='rpp' id='rpp' onChange='this.form.submit();'> [line 855] >--> <option value='10' ".if (!(strcmp('10', $rpp))) {echo 'SELECTED';} .">10</option> <option value='20' '.if (!(strcmp('20', $rpp))) {echo 'SELECTED';} .' >20 </option> <option value='50' '.if (!(strcmp('50', $rpp))) {echo 'SELECTED';} .' >50 </option> <option value='100' '.if (!(strcmp('100', $rpp))) {echo 'SELECTED';} .' >100 </option> </select> </label> </form> "; error: Parse error: parse error, unexpected T_IF in /home/pricetak/public_html/results.php on line 855 Link to comment https://forums.phpfreaks.com/topic/41807-solved-parse-error-please-suggest/ Share on other sites More sharing options...
JakeTheSnake3.0 Posted March 8, 2007 Share Posted March 8, 2007 maybe it's because you're trying to echo something inside of a string definition? I'm not much for complex mixing of statements but this is how I'd do it... isSelected = function(num) { if (!(strcmp(num, $rpp))) { return " SELECTED"; } else { return ""; } } $resultsperpage="<form name='form1' method='post' action='something.php'> <label> Results per page <select name='rpp' id='rpp' onChange='this.form.submit();'> <option value='10'" .isSelected('10'). ">10</option> // etc, etc. Link to comment https://forums.phpfreaks.com/topic/41807-solved-parse-error-please-suggest/#findComment-202776 Share on other sites More sharing options...
Guest upirate Posted March 8, 2007 Share Posted March 8, 2007 thanks !!! Link to comment https://forums.phpfreaks.com/topic/41807-solved-parse-error-please-suggest/#findComment-202795 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.