Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $dbHost = 'localhost'; // localhost will be used in most cases
- // set these to your mysql database username and password.
- $dbUser = 'user';
- $dbPass = 'pass';
- $dbDatabase = 'stock'; // the database you put the table into.
- mysql_connect("localhost", "user", "pass") or die(mysql_error());
- mysql_select_db("stock") or die(mysql_error());
- $query="SELECT category FROM subcategory_table";
- /* You can add order by clause to the sql statement if the names are to be displayed
- in alphabetical order */
- $result = mysql_query ($query);
- echo "<select name='category'>";
- // printing the list box select command
- while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
- echo "<option value=$nt[category]>$nt[category]</option>";
- /* Option values are added by looping through the array */
- }
- echo "</select>";// Closing of list box
- ?>
- echo '<option value="' . $nt[category] . '">' . $nt[category] . '</option>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement