EagerWolf Posted June 8, 2007 Share Posted June 8, 2007 Hi ... I've got a problem with checkbox group... <label> <input type='checkbox' name='tv1' value='1' id='tv1'/>DVD </label> <label> <input type='checkbox' name='tv1' value='2' id='tv1'/>VHS </label> <label> <input type='checkbox' name='tv1' value='3' checked='checked' id='tv1'/>SAT TV </label> The problem is if more values are being checked only last is strored (value 3) .... I read about storing values into array but I am not familiar with this ... Can anyone explain how is this done .. Thanks! BR Link to comment https://forums.phpfreaks.com/topic/54731-solved-checkbox-in-array/ Share on other sites More sharing options...
Stuie_b Posted June 8, 2007 Share Posted June 8, 2007 Like you say, you need too put the values into an array before sending them otherwise it wont work, The following edit will do just that, <label> <input type='checkbox' name='tv1[]' value='1' id='tv1'/>DVD </label> <label> <input type='checkbox' name='tv1[]' value='2' id='tv1'/>VHS </label> <label> <input type='checkbox' name='tv1[]' value='3' checked='checked' id='tv1'/>SAT TV </label> As you should be able too see the only thing needed to be done was too add brackets too the name (tv1[]) hope it helps Stuie Link to comment https://forums.phpfreaks.com/topic/54731-solved-checkbox-in-array/#findComment-270702 Share on other sites More sharing options...
EagerWolf Posted June 10, 2007 Author Share Posted June 10, 2007 Thanks! Problem solved! Link to comment https://forums.phpfreaks.com/topic/54731-solved-checkbox-in-array/#findComment-271778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.