ok well iv'e done a script that adds in a stock code, name and quantity into mysql, next i wont to be able to create a array which grabs the stock_code fields and prints them into a select box, does anyone have any examples i could learn of. thanks
You can use a simple one like that: <?php /** * @author WhaLberg * @copyright 2008 * @site www.codinglabs.org */ // gets the stock codes. $query = mysql_query("SELECT stock_code FROM stockcodes"); while ($result = mysql_fetch_array($query)) { // assings the stock codes to an array. $codes[] = $result['stock_code']; } // starts a selectbox. echo "<select name=\"stockcode\">"; foreach ($codes AS $code) { // add options for the stock codes. echo "<option value=\"$code\">$code</option>"; } // ends the selectbox. echo "</select>"; ?> PHP: