tomindo Posted December 22, 2010 Share Posted December 22, 2010 echo "<input type=checkbox name=b[$a] value=1>view,"; I m trying to submit array b, it works fine if $a is string without space but string with space like "my name". That is really weird Quote Link to comment https://forums.phpfreaks.com/topic/222411-array-key-with-space-html-input-submit/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2010 Share Posted December 22, 2010 Your HTML is invalid. You need quotes around each attribute value - echo "<input type='checkbox' name='b[$a]' value='1'>view,"; Quote Link to comment https://forums.phpfreaks.com/topic/222411-array-key-with-space-html-input-submit/#findComment-1150425 Share on other sites More sharing options...
tomindo Posted December 22, 2010 Author Share Posted December 22, 2010 yes, that fixed the problem but I have used html attributes for a while without quotes , seems to be no problems at all . What did this happen? Quote Link to comment https://forums.phpfreaks.com/topic/222411-array-key-with-space-html-input-submit/#findComment-1150429 Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2010 Share Posted December 22, 2010 I have used html attributes for a while without quotes Then you have been producing invalid html for a while too. Just because something works, does not mean it is correct. See this link to validate your html output - http://validator.w3.org/ Quote Link to comment https://forums.phpfreaks.com/topic/222411-array-key-with-space-html-input-submit/#findComment-1150431 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.