reckdan Posted April 18, 2008 Share Posted April 18, 2008 I am developing a system which will store selected images in a database. I have to list boxes one contains list of all images the other contains only selected images. Ones you select an image in the all images list box and click on send it moves the image to selected images listbox using javascript. Now I want to move or copy all the images in the selected images list box into an array in php so that i can save it into the database. I need help urgently. thanks Link to comment https://forums.phpfreaks.com/topic/101675-list-box-problem/ Share on other sites More sharing options...
zenag Posted April 18, 2008 Share Posted April 18, 2008 it will display dynamic array values from drop down .... <script type="text/javascript"> //var test=""; function val(str) { document.frm.submit(); } // </script></head> <body> <? if ($_POST['str']) { if ($_SESSION['arr']) { $used = array(); $used = $_SESSION['arr']; $used[] = $_POST['str']; $_SESSION['arr'] = $used; } else { $arr = array(); $arr[] = $_POST['str']; $_SESSION['arr'] = $arr; } } $sql=mysql_query("select * from tablename"); ?><form name="frm" action="" method="post"> <select name="str" onChange="val(this.value)"><? while($row=mysql_fetch_array($sql)) {?> <option value="<? echo $row["fieldname"];?>"><? echo $row["ieldname"];?></option><? } ?></select></form> <?php print_r($_SESSION['arr']); ?> <div id="stre"></div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/101675-list-box-problem/#findComment-520226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.