Vivid Lust Posted October 28, 2008 Share Posted October 28, 2008 Hey all Can some nice person fix my code, thanks loads! <?php while($i < $im ){ $i = $i + 1; echo "<input type=/"checkbox/" name=/"bg/" value="/$iu[$i]/""; if($bg == /"$iu[$i]/"){ echo( "checked" ); } ?> echo ">"; } ?> Link to comment https://forums.phpfreaks.com/topic/130480-unexpected/ Share on other sites More sharing options...
bobbinsbro Posted October 28, 2008 Share Posted October 28, 2008 fixed: <?php while($i < $im ){ $i = $i + 1; echo "<input type=/"checkbox/" name=/"bg/" value="/$iu[$i]/""; if($bg == /"$iu[$i]/"){ echo( "checked" ); } echo ">"; } ?> you had an extra ?> in the middle of your code... Link to comment https://forums.phpfreaks.com/topic/130480-unexpected/#findComment-676876 Share on other sites More sharing options...
dropfaith Posted October 28, 2008 Share Posted October 28, 2008 <?php while($i < $im ){ $i = $i + 1; echo "<input type=/"checkbox/" name=/"bg/" value="/$iu[$i]/""; if($bg == /"$iu[$i]/"){ echo( "checked" ); } echo ">"; } ?> your closing your php before the echo if($bg == /"$iu[$i]/"){ echo( "checked" ); } ?> Link to comment https://forums.phpfreaks.com/topic/130480-unexpected/#findComment-676878 Share on other sites More sharing options...
Vivid Lust Posted October 28, 2008 Author Share Posted October 28, 2008 changed still getting same error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' Link to comment https://forums.phpfreaks.com/topic/130480-unexpected/#findComment-676880 Share on other sites More sharing options...
kenrbnsn Posted October 28, 2008 Share Posted October 28, 2008 Actually, that won't cause the error the OP reported. The bigger problem is that the wrong character is used to escape the double quotes. It should be "\" not "/", plus it's used too many times. Try: <?php while($i < $im ){ $i++; echo '<input type="checkbox" name="bg" value="' . $iu[$i] . '"'; if($bg == $iu[$i]){ echo( "checked" ); } echo ">"; } ?> By using the single quote, you can avoid escaping the double quote altogether. Ken Link to comment https://forums.phpfreaks.com/topic/130480-unexpected/#findComment-676883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.