ScaperExe ScaperExe - 7 months ago 15
SQL Question

Option value from select statement

I want to be able to have a select statement that lists everything from my category table.

Then once a option has been picked it assigns that option value to what I selected. Allowing me to add it to my table.

Currently my option value is set to

/"cleaner"/
I obviously don't want that as it's a static option. I've tried setting the option value to
$['articleCategory']
but that gives me some whitespace error.

Any help will be much appreciated.




$category = $pdo->query('SELECT articleCategory FROM Category');

foreach ($category as $row) {

echo "<option value=\"Cleaner\">" . $row['articleCategory'] . "</option>";
}
?>
</select>

</td>

Answer
foreach ($category as $row) {

   echo "<option value=".$row['articleCategory'].">" . $row['articleCategory'] . "</option>";
}

welcome.

Comments