adding hidden input value inside option

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
glendon
Forum Newbie
Posts: 5
Joined: Wed Nov 06, 2013 7:35 am

adding hidden input value inside option

Post 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
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: adding hidden input value inside option

Post 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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
glendon
Forum Newbie
Posts: 5
Joined: Wed Nov 06, 2013 7:35 am

Re: adding hidden input value inside option

Post by glendon »

ok im a beginner so how can i ad a hidden value in an option is it possible?
Post Reply