Anon_guy
Anon_guy

Reputation: 155

dynamic dropdown select not entering value to db on submit

Im having issues with data not being entered into the db. I have a form with 5 inputs and a select The drop down select is a dynamic list fro the db. When the form is submitted nothing is entered in the db for the campaign_owner columns. I have the values="" which I think is the problem, but I also tried

<option value="<?php echo $user['username']; ?>"><?php echo $user['username']; ?></option>

yet that doesn't help.The dropdown shows the data I want and allows you to select it on the page it just doesn't submit it and I dont know why.

HTML:

<div class="col-sm-5 col-sm-push-1 form-group required">
  <label class="control-label" ><?php echo $entry_owner; ?></label>
  <select name="user-list" id="user-list">
    <?php foreach ($users as $user) { ?>
    <option value="<?php echo $user['username']; ?>"><?php echo $user['username']; ?></option>
    <?php } ?>
  </select>
</div>

Upvotes: 0

Views: 26

Answers (1)

pucky124
pucky124

Reputation: 1509

HTML forms work with the input/select/textarea etc. names. Your select is named "user-list" which means that when submitted it will be under the key user-list. You'll need to map that to the campaign_owner column.

Upvotes: 1

Related Questions