ScaperExe ScaperExe - 2 years ago 105
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

I obviously don't want that as it's a static option. I've tried setting the option value to
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>";


Answer Source
foreach ($category as $row) {

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download