php - whitespace in select dropdown, pulled from mysql -
i'm using populate dropdown:
$result = mysql_query("select user `users` order user asc") or die(mysql_error()); echo '<select name="user" class="user">'; while ($row = mysql_fetch_array($result)) { echo "<option value=".$row['user'].">".$row['user']."</option>"; } echo '</select>';
but source this:
<select name="user" class="user"><option value=joe bloggs>joe bloggs</option>
so when this:
var user = $('.user').val();
it sees "joe" not "joe bloggs"?? ideas
$result = mysql_query("select user `users` order user asc") or die(mysql_error()); echo '<select name="user" class="user">'; while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.htmlspecialchars($row['user']).'">'.htmlspecialchars($row['user']).'</option>'; } echo '</select>';
corrected :)
Comments
Post a Comment