jagguy Posted November 1, 2006 Share Posted November 1, 2006 Hi,I want to have a drop down list on a form full of data from a mysql database. How do i set this up with php or is it easier with javascript? Link to comment https://forums.phpfreaks.com/topic/25790-drop-down-list/ Share on other sites More sharing options...
redarrow Posted November 1, 2006 Share Posted November 1, 2006 [code]<?php$db=mysql_connect('localhost' , 'xxxxxx' , 'xxxxxx' );mysql_select_db('xxxxxx',$db);$query="select from xxxxxx where xxxxx='xxxxx'";$result=mysql_query($query);echo"<select name='xxxxxx'>";while($record=mysql_fetch_assoc($result)){echo" <option value=' '".$record['xxxx']."''>'".$record['xxxxx']."'</option>";}echo"</select>";?>[/code]array way ok.[code]<?php$x=array('php','asp','javascript');echo"<select name='x'>";foreach($x as $d){echo"<option value='$d'>$d</option>";}echo"</select>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/25790-drop-down-list/#findComment-117764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.