I have the following code in my form, which gets an option & value based on the user_id. I need to add the 'value' select to a database. How do I go about doing this? I can add the value of normal drop menu, but because this runs a query I'm not to sure. Normally the option value has a name, which you just insert. But I tried inserting "$row['value']" and I get an error.
Any help greatly appreciated.
Cheers
Ben
<SELECT NAME="select">';
if ($result=mysql_query("SELECT option, value FROM table WHERE user_id = $sUserID"))
{
while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
echo "<OPTION VALUE=http://www.phpbuilder.com/board/archive/index.php/".$row['option'].">".$row['value']."</option>";
};
}
else
{
echo mysql_error();
};
echo '</SELECT>
Any help greatly appreciated.
Cheers
Ben
<SELECT NAME="select">';
if ($result=mysql_query("SELECT option, value FROM table WHERE user_id = $sUserID"))
{
while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
echo "<OPTION VALUE=http://www.phpbuilder.com/board/archive/index.php/".$row['option'].">".$row['value']."</option>";
};
}
else
{
echo mysql_error();
};
echo '</SELECT>