Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Get List/Menu value

Links for php scripts

Moderators: macek, egami, gesf

Get List/Menu value

Postby kiwi » Thu Sep 16, 2004 11:01 pm

i use this code to generate the List/Menu according to numbers of record in a table, but now i can't retrieve the value of each List/Menu, can you help me

<?
print '<table width="438" border="0" align="center">';

$result = mysql_query("SELECT * FROM partcategory where CategoryName != '$part[CategoryName]' order by CategoryName ASC");
while($row = mysql_fetch_array($result))
{
print '<tr class="style1">';
print '<td width="111">'.$row[CategoryName].'</td>';
print '<td width="317"><select name="$row[PartCategoryID]">';

$record = mysql_query("SELECT * FROM part");

print '<option value="None">None</option>' . "\n";
while($parts = mysql_fetch_array($record))
{


if ($parts[CategoryName]==$row[CategoryName] && $parts[TypeName]==$part[TypeName])
{
$detail = mysql_query("SELECT * FROM detail where PartID = '$parts[PartID]'");
$price = mysql_fetch_array($detail);
print '<option value="' . $parts['ID'] . '" "' . $parts['ID'] . '">' . $parts['Brand'] . ' ' . $parts['Model'] .' -> ' . $parts['PartID'] . ' -> RM ' . $price['Price'] . '</option>' . "\n";
}
}

print '</select></td>';
}
print '</table>';

?>


i know the value should retirve from 'name = ' but i declare as $row[' ' ' '] is this the problem, i can't get the value already, how, help me please, thanks
kiwi
New php-forum User
New php-forum User
 
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am

Postby gesf » Thu Sep 16, 2004 11:41 pm

Code: Select all
print '<option value="' . $parts['ID'] . '" "' . $parts['ID'] . '">...
??
Check the html code and see if the options' values were properly printed.
Seems that your options will be something like(example):
Code: Select all
<option value="2" "2">

Must be: <option value="2">
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby kiwi » Fri Sep 17, 2004 9:48 am

what i mean is, if u want to show the List/Menu then u use this:
echo $select;

right?
the select actually is the list/menu name, but i i use looping to create the list/menu, so the name is like array, but when i try to print the value for each list/menu, it doesnt work, may be is the name is in array, u guy got any method so show the value, please, thanks
kiwi
New php-forum User
New php-forum User
 
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron