denniskarpes Posted February 17, 2011 Share Posted February 17, 2011 Hello, I want to create an order form where people can order shirts with sizes and quantities. So in 1 form you have a column where people can check the size and after that the quantities. (see below the form) As result i want after pressing submit and selecting for example 3 shirts Large and 1 small: S=1, M=0, L=3, XL=0, XXL=0 echo "<form method=\"post\" action=".$PHP_SELF."> <label>aantal <input name=\"textfield[]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input class=\"option2\" id=\"option2\" name=\"maat[]\" type=\"checkbox\" value=\"S\">S<br /> <input name=\"textfield[]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input class=\"option2\" id=\"option2\" name=\"maat[]\" type=\"checkbox\" value=\"m\">m<br /> <input name=\"textfield[]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input class=\"option2\" id=\"option2\" name=\"maat[]\" type=\"checkbox\" value=\"l\">l<br /> <input name=\"textfield[]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input class=\"option2\" id=\"option2\" name=\"maat[]\" type=\"checkbox\" value=\"XL\">XL<br /> <input name=\"textfield[]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input class=\"option2\" id=\"option2\" name=\"maat[]\" type=\"checkbox\" value=\"XXL\">XXL<br /> </label> <input type=submit value=Select></form>"; i hope you can help me with it. thanks in regard! Link to comment https://forums.phpfreaks.com/topic/227985-combine-a-checkbox-and-textfield-in-array/ Share on other sites More sharing options...
sasa Posted February 17, 2011 Share Posted February 17, 2011 try echo "<form method=\"post\" action=".$PHP_SELF."> <label>aantal <input name=\"textfield[s]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input name=\"textfield[M]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input name=\"textfield[L]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input name=\"textfield[XL]\" type=\"text\" size=\"4\" maxlength=\"3\"> <input name=\"textfield[XXL]\" type=\"text\" size=\"4\" maxlength=\"3\"> <</label> <input type=submit value=Select></form>"; and on submit page print_r($_POST['textfield']); Link to comment https://forums.phpfreaks.com/topic/227985-combine-a-checkbox-and-textfield-in-array/#findComment-1175675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.