Hi ,
any one please give reply for this question..
Urgent pls...
I taken values from database , i can able to display the values on the browser, now i want to put those values inside the combo box. MY CODE IS
$str = array(); foreach($this->advertiserinfo as $adname)
$str = $str.$this->escape($adname->advertiser_name).'<br />';
//echo $this->formSelect('adver_tiser', null, null, $str);( i want to display DB values inside the combo box )
echo $str;
How can i put the those values inside the combo box?
How to move selected values of one combo box to another combo box using >> button in php?
Thanks,
Sreenu.G
PHP combo box
Moderator: General Moderators
Re: PHP combo box
Seems like you are dragging another programming language into your php code. If you are using foreach as a loop, I would have expected to see the code to repeat surrounded by curly brackets. {} And I'm having trouble following how your array or value is generated, but if $str represents each value you want in a dropdown, you need to print out the code for an html select box and echo the php value in as each option value.
I don't understand your second question about moving the values with a button.
Code: Select all
<select name="name">
<?php
foreach (blah blah) {
print ("<option value=\"$str\">$str</option>");
}
?>
</select>-
callsreenu
- Forum Newbie
- Posts: 6
- Joined: Sun Nov 23, 2008 11:03 pm
Re: PHP combo box
sparrrow wrote:Seems like you are dragging another programming language into your php code. If you are using foreach as a loop, I would have expected to see the code to repeat surrounded by curly brackets. {} And I'm having trouble following how your array or value is generated, but if $str represents each value you want in a dropdown, you need to print out the code for an html select box and echo the php value in as each option value.I don't understand your second question about moving the values with a button.Code: Select all
<select name="name"> <?php foreach (blah blah) { print ("<option value=\"$str\">$str</option>"); } ?> </select>
-
callsreenu
- Forum Newbie
- Posts: 6
- Joined: Sun Nov 23, 2008 11:03 pm
Re: PHP combo box
Thank u , i got the answer....................