micxnet Posted February 26, 2006 Share Posted February 26, 2006 Hi there,I am currently buiding a part generator page, that allows you to construct multiple parts at one time. Basically it is made up of two multiple select boxes with another text box with the quantity of base products to a part. I require those two multi-select drop down's to be mutli-dimensional arrays for the form processor I developed.Unfortunately, it wasn't as easy as adding []. So how would I go about trying to do this?Here is my code for the HTML form:[code]<table class="main" cellpadding="0" cellspacing="10" align="center"><tr><td><h1>Base + Parts Dashboard</h1></td></tr><tr><td><table class="quick" cellpadding="0" cellspacing="10" align="center" width="450"><tr><td colspan="3" valign="top"><h2>Parts Management</h2></td></tr><form name="partgen" action="index.php?i=99" method="post"><tr><td valign="top">Select Base(s):</td><td><select class="drop" name="field[part_base_id[]]" multiple="multiple" size="5"><?=selectgen('base');?></select></td><td><input name="name[part_base_id]" type="hidden" value="Select Base(s)" /></td></tr><tr><td valign="top">Select Make(s):</td><td><select class="drop" name="field[part_make_id[]]" multiple="multiple" size="5"><?=selectgen('make');?></select></td><td><input name="name[part_make_id]" type="hidden" value="Select Make(s)" /></td></tr><tr><td>Kit Count:</td><td><input type="text" name="field[part_kit_count]" class="text"/></td><td><input name="name[part_kit_count]" type="hidden" value="Kit Count" /><b>i.e 2</b></td></tr><tr><td colspan="3" align="center"><input type="submit" name="submit" value="Submit" class="submit" /></td></tr><input name="table" type="hidden" value="part" /><input name="key" type="hidden" value="part_id" /></form></table></td></tr></table>[/code]Thanks in advance. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted February 26, 2006 Share Posted February 26, 2006 Your html is very difficult to read. You should clean it up.[code]<table class="main" cellpadding="0" cellspacing="10" align="center"> <tr> <td><h1>Base + Parts Dashboard</h1></td> </tr> <tr> <td><form name="partgen" action="index.php?i=99" method="post"> <table class="quick" cellpadding="0" cellspacing="10" align="center" width="450"> <tr> <td colspan="3" valign="top"><h2>Parts Management</h2></td> </tr> <tr> <td valign="top">Select Base(s):</td> <td><select class="drop" name="field[part_base_id][]" multiple="multiple" size="5"> <?=selectgen('base');?> </select> </td> <td><input name="name[part_base_id]" type="hidden" value="Select Base(s)" /></td> </tr> <tr> <td valign="top">Select Make(s):</td> <td><select class="drop" name="field[part_make_id][]" multiple="multiple" size="5"> <?=selectgen('make');?> </select> </td> <td><input name="name[part_make_id]" type="hidden" value="Select Make(s)" /></td> </tr> <tr> <td>Kit Count:</td> <td><input type="text" name="field[part_kit_count]" class="text"/></td> <td><input name="name[part_kit_count]" type="hidden" value="Kit Count" /><b>i.e 2</b></td> </tr> <tr> <td colspan="3" align="center"><input type="submit" name="submit" value="Submit" class="submit" /></td> </tr> </table> <input name="table" type="hidden" value="part" /> <input name="key" type="hidden" value="part_id" /> </form> </td> </tr></table>[/code]Do a print_r on $_POST to see how it looks. Quote Link to comment Share on other sites More sharing options...
micxnet Posted February 26, 2006 Author Share Posted February 26, 2006 Here is what is outputted with the changes:Array ( [part_base_id] => Array ( [0] => 123 ) [part_make_id] => Array ( [0] => 1 [1] => 2 ) [part_kit_count] => 1 )Compared to with the old code:Array ( [part_base_id[] => 123 [part_make_id[] => 2 [part_kit_count] => 1 )Thanks for the help. Its working exactly how I need it. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted February 26, 2006 Share Posted February 26, 2006 Did you notice what I changed in your code? I didn't just clean it up for you. Quote Link to comment 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.