Page 1 of 1

adding hidden input value inside option

Posted: Tue Nov 19, 2013 10:05 am
by glendon
hello everyone im new here i have problem adding hidden input value inside option in php

Code: Select all

<?php echo "<select name=dentist><option name=dentist> - Select Dentist -";echo"</option>";

				$ressss = mysql_query("select * from dentists");
				$rowwww = mysql_num_rows($ressss);
				for($i=0;$i<$rowwww;$i++){
				
				echo"<option name=dentist>Dr. " .mysql_result($ressss,$i,"denfname").' '.mysql_result($ressss,$i,"denlname");
				echo "<input type='text' name='denid' value=".mysql_result($ressss,$i,"denid").">";
			}?>	
it is showing [img]file:///C:/WebDev%20Structures/Untitled.png[/img] only the first doctor added is inside the option, why? the input type is text and i'll just hide it if im successful, it is' printing the correct value but i just cant put the doctors inside the option aside from the 1st one added

Re: adding hidden input value inside option

Posted: Tue Nov 19, 2013 3:49 pm
by social_experiment
glendon wrote:the input type is text and i'll just hide it if im successful, it is' printing the correct value but i just cant put the doctors inside the option aside from the 1st one added
^ this doesn't really make a lot of sense :|

Do you want to display the names of all the doctors inside textboxes ? You are succeeding but only the first value is being displayed? You should also look at your HTML; you open a select tag but never close it; you also can't have text inputs inside a select element.

Re: adding hidden input value inside option

Posted: Wed Nov 20, 2013 9:51 am
by glendon
ok im a beginner so how can i ad a hidden value in an option is it possible?