searls03 Posted March 31, 2012 Share Posted March 31, 2012 Ok so I need to know how this code: <form> <?php // Query member data from the database and ready it for display $sql1 = mysql_query("SELECT * FROM products where id='".$pid."'"); while($row = mysql_fetch_array($sql1)){ $product =$row["product"]; $pid=$row["id"]; ?> <?php // Query member data from the database and ready it for display $sql4 = mysql_query("SELECT * FROM labels where item_id='".$pid."'"); while($row = mysql_fetch_array($sql4))for($i=0; $i<1; $i++){ $label =$row["label"]; $lid=$row['id']; echo $label; ?> <select name="name1[]"> <?php // Query member data from the database and ready it for display $sql3 = mysql_query("SELECT * FROM options where item_id='".$pid."' && label_id='".$lid."'"); while($row = mysql_fetch_array($sql3)){ $option =$row["option"]; ?> <option value="<?php echo $option; ?>"> <?php echo $option; ?> </option> <?php } ?> </select> </br> <?php } ?> <?php }?> If this product is for someone other than the listed, change it, otherwise leave it:<br /> <input ID="outputField<?php echo $id; ?>" name="name123" type="text" VALUE="..." /> <input name="qty" type="hidden" value="<?php echo $qty; ?>" /> <input type="submit" id="hellobob<?php echo $id; ?>" value="Submit" /> </form> specifically this part: <?php // Query member data from the database and ready it for display $sql4 = mysql_query("SELECT * FROM labels where item_id='".$pid."'"); while($row = mysql_fetch_array($sql4))for($i=0; $i<1; $i++){ $label =$row["label"]; $lid=$row['id']; echo $label; ?> <input type="text" name="name[]" /> <input type="text" name="name2[]" /> <select name="name1[]"> <?php // Query member data from the database and ready it for display $sql3 = mysql_query("SELECT * FROM options where item_id='".$pid."' && label_id='".$lid."'"); while($row = mysql_fetch_array($sql3)){ $option =$row["option"]; ?> <option value="<?php echo $option; ?>"> <?php echo $option; ?> </option> <?php } ?> </select> </br> I need to create an array from the name(1,2)[] parts. The thing is, they are going to be pulled in a loop and return all results. so there could be multiple name1[]'s name2[]'s or name[]'s. I need to know how I would combine each one in it's loop to make part of a string. thing is, the first time name[] would be included, second time it wouldn't be included. then the arrays combine to make one. so the final array looks like this name[] name1[] name2[] name1[] name2[] name1[] name2[]. etc. anyhelp on this? Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/ Share on other sites More sharing options...
searls03 Posted March 31, 2012 Author Share Posted March 31, 2012 *final string, not array Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/#findComment-1333072 Share on other sites More sharing options...
searls03 Posted March 31, 2012 Author Share Posted March 31, 2012 so something like this is what would result $result= name[] name1[] name2[] name1[] name2[] name1[] name2[] Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/#findComment-1333077 Share on other sites More sharing options...
chriscloyd Posted April 1, 2012 Share Posted April 1, 2012 just do <?php join(" ", $array);?> Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/#findComment-1333269 Share on other sites More sharing options...
searls03 Posted April 1, 2012 Author Share Posted April 1, 2012 but what is $array? Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/#findComment-1333293 Share on other sites More sharing options...
searls03 Posted April 1, 2012 Author Share Posted April 1, 2012 nevermind Link to comment https://forums.phpfreaks.com/topic/260088-post-with-arrays/#findComment-1333301 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.