Fill html dropdown using array from database php -
i'm trying fill dropdown in html code below.i have searched here other questions , tried not working me? can me find mistake?
<form id="data" class="form-geofence" role="form" method="post" action="geofencedata.php"> <select name="category_id"> <option value="">--- select ---</option> <?php include_once'./connectionusers.php'; $result=pg_query("select * geofence;"); while ($row = pg_fetch_array($result)) { ?> <option value="" ><?php echo $row["name"];?></option> <?php } ?> </select>
i have used same php code seperately , shows names
make sure database connection right, , use below code
<form id="data" class="form-geofence" role="form" method="post" action="geofencedata.php"> <select name="category_id"> <option value="">--- select ---</option> <?php include_once'./connectionusers.php'; $result=pg_query("select value geofence;"); while ($row = pg_fetch_array($result)) { echo "<option value='".$row['value']."'>".$row['value']."</option>"; } ?> </select>
Comments
Post a Comment