Hi i m trying to get the values from database and put it into the select options.. i m using code- <?php $con = mysql_connect("localhost","cdccpl","d123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cdccpl_aus", $con); $result = mysql_query("SELECT * FROM bak_bill_cust"); while( $row = mysql_fetch_array( $result ) ): $option = $row["cust_code"]; echo "<option value='$row[cust_code]'>$row[cust_code]</option>"; endwhile; mysql_close($con);?> Code (markup): but i m getting displayes with the values as-- Customer auswidestonemanpnicholsonllwmplnewuserguestanftasturnbullanglic Code (markup): means values getting displayed one after another and not in option.. why so.. plz help
try this <?php $con = mysql_connect("localhost","cdccpl","d123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("cdccpl_aus", $con); $result = mysql_query("SELECT * FROM bak_bill_cust"); echo"<select name='D1'>"; while( $row = mysql_fetch_array( $result ) ): $option = $row["cust_code"]; echo "<option value='$row[cust_code]'>$row[cust_code]</option>"; endwhile; echo "</select>"; mysql_close($con);?> PHP: