Forum Moderators: coopster
First the code:
<?php while ($row = mysql_fetch_array($form)) {
echo '<option value='.$row['site'].'>'.$row['site'].'</option>';
};
This snippet takes a list of names from a table (which is $form) and populates a drop down list. The problem I am having is that the variable for the option value is being tunicated at the first space.
E.G
'Big Jumpers' becomes 'Big'.
I suspect the problem is the > character between the two variables but I can't seem to find a way round it.
Suggestions?
echo '<option value="'.$row['site'].'">'.$row['site'].'</option>'; also, you might want to look into escaping your strings for html usage, depending on charsets etc, look at htmlentities() in php.