I am looping over an array and passing these values to a select list as follows
<select class="form-control chzn-select">
<?php while($row = mysqli_fetch_array($query)){
echo "<option>" . $row['schoolname'] . "</option>";
}?>
</select>
I have to pass $row['schoolcode'] in <option value='here'>
. How do I do that?
echo "<option value='" . $row['schoolcode'] . "'>" . $row['schoolname'] . "</option>";
What does this have to do with jQuery?
Are you trying to do the following:
echo '<option value="' . $row['schoolcode'] . '">' . $row['schoolname'] . '</option>';
Also: Try to separate logic from presentation. (A common way to do so is the MVC or MVVM way) It is not good to communicate with the database while building the html. (What happens on an error? You cannot redirect and will send an incomplete or wrong html)