I am creating a Custom Registration Form in wordperss. While creating a dynamic select option (Drop down), i am getting nothing as output for the select option. i will be very thankful if someone please help me in this regard.
Below is my code
'''
<p>
<label>Country</label>
<div>
<?php
global $wpdb;
$query=mysql_query("select * from pv_countries");
$rowcount=mysql_num_rows($query);
?>
<select name="country">
<option value="">Select Any One</option>
<?php
for($i=1;$i<=$rowcount;$i++)
{
$row=mysql_fetch_array($query);
?>
<option value="<?php echo $row["countryName"] ?>"><?php echo
$row["countryName"] ?></option>
<?php
}
?>
</select>
</div>
</p>
Make your query as like.
while($row = mysql_fetch_array($query) ){
?>
<option value="<?php echo $row['countryName'] ?>"><?php echo $row['countryName'] ?></option>
<?php }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.