1 <?php function database_connect($select_database) { $resource_link = mysql_connect("localhost", "root", ""); if (mysql_select_db($select_database, $resource_link)) { return $resource_link; } else { echo "Cannot connect to DB"; return false; } } function print_dropdown($query, $link) { $queried = mysql_query($query, $link); $menu = '<select cha_PointID="cha_CoronalHoleNumber">'; while ($result = mysql_fetch_array($queried)) { $menu .= ' <option value="' . $result['cha_PointID'] . '">' . $result['cha_CoronalHoleNumber'] . '</option>'; } $menu .= '</select>'; return $menu; } //Some other form elements, or just start a form. echo '<form method="post" action="">'; //The important bit echo print_dropdown("SELECT cha_PointID, cha_CoronalHoleNumber FROM tbl_coronal_hole_annotations LIMIT 0, 30", database_connect("carina")); //Some other form elements, or just end the form. echo '<input type="submit" name="submit" value="submit"/> </form>';
//echo urlencode (print_dropdown("SELECT category_id, category_name FROM category")); */ function print_dropdown($query) { $queried = mysql_query($query); $menu = '<select size="1" name="category_id" id="" style="width:100px;">'; //$menu = '<dd>'; while ($result = mysql_fetch_array($queried)) { $menu .= '<option value="' . $result['category_id'] . '">' . $result['category_name'] . '</option>'; //$menu .= '<input type="radio" name="group2" value="'.$result['category_id'].'">' .$result['category_name'] . '<br />'; } $menu .= '</select>'; //$menu .= '</dd></dl>'; return $menu; } echo print_dropdown("SELECT category_id, category_name FROM category"); //echo urlencode (print_dropdown("SELECT category_id, category_name FROM category")); ?> </div><div style="clear:both;"></div></div> </p> <dl class="submit"> <input type="submit" value="Unesi u bazu" id="submit" name="unosproizvoda"/> </dl> </fieldset> </form> </div> *slika mora biti manja od 1200*1200 piksela i manja od 150kB, dozvoljeni su jpg i jpeg formati.