html - Drop Down List and PHP -



html - Drop Down List and PHP -

i have drop downwards list select alternative , info written within retrieved database query .

<select name="moto"> <?php include 'connessione.php'; $qry = "select nomeoggetto oggetto"; $result = mysql_query($qry); while($row = mysql_fetch_array($result)) { echo '<option value='.$row["nomeoggetto"].'>'.$row["nomeoggetto"].'</option>'; } ?> </select>

the problem if in menu have name of motorbike 1 space between name , illustration ( kawasaki ninja) , when send php page post method displays kawasaki . how can show entire name space included ? php page :

<?php echo $_post['moto']; ?>

you have set quotes around attribute values in html

from

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

to

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

php html sql select

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -