hi all;

I have code that proform the dropdown list of the country. then after submmitted, it show the ouput, but the country i select from my drop down list, did not display.

here is my whole code of drop down list.

<?php
	echo '<input name="country" type="hidden" id="country" size="30" maxlength="75">';
			echo'<select name="country">';
				$res=mysql_query("select * from county_hotels");
					if(mysql_num_rows($res)==0) {
						echo "there is no data in table..";
				}
				else {
				for($i=0;$i<mysql_num_rows($res);$i++) {
					$row=mysql_fetch_assoc($res);
					echo "<option value=".$row['id'].">$row[country]</option>";
				}
			}
		echo'</select>';
	?>

here is the ouput, after submitted. the country does not display

Country :
Name : xxxxx
email : xxxxx
phone : xxxxx
Services : xxxxx
Other Requirements : xxxxxx

Any idea?

why u have kept the hidden field tats why data is empty.

why u have kept the hidden field tats why data is empty.

thanks for the reply, but it desame problem;

i want to know whether u r getting values in drop down.please send the full code

you should have to post the full code.but i may work

<option <?php if($row[country]== $_REQUEST[country]){ echo 'selected';} ?> >$row[country]</option>

this code show the selected country in the dropdown box when u submit the form

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.