treyhunsucker
Programmer
Hello,
I have a html drop down box that pulls the data from a mysql database. Everything works but there is 1 small glitch.
If the data has a space in it, ex. "Option 1", when pulling from mysql it shows up as "Option 1" in the drop down but when it's posted to the next processing page, it shows up as "Option"
I've seen examples of people using preg_replace and other functions to resolve issues like this, but none that data fill from a database.
Here is how it pulls the data:
<td>
<b>Client:</b><br>
<input type="text" name="z6" size="10" value="<? echo "$z6"?>">
<?php
$db = mysql_connect("localhost","user","pass");
mysql_select_db ("inventory");
$result = mysql_query("SELECT * FROM customer ORDER by d1")
or die(mysql_error());
echo "<select name=z6>";
echo "<option value=" . $z6 . "></option>";
while($row = mysql_fetch_array( $result )) {
echo "<option value=" . $row[d1] . ">" . $row[d1] . "</option>";
}
?>
</td><td>
I have a html drop down box that pulls the data from a mysql database. Everything works but there is 1 small glitch.
If the data has a space in it, ex. "Option 1", when pulling from mysql it shows up as "Option 1" in the drop down but when it's posted to the next processing page, it shows up as "Option"
I've seen examples of people using preg_replace and other functions to resolve issues like this, but none that data fill from a database.
Here is how it pulls the data:
<td>
<b>Client:</b><br>
<input type="text" name="z6" size="10" value="<? echo "$z6"?>">
<?php
$db = mysql_connect("localhost","user","pass");
mysql_select_db ("inventory");
$result = mysql_query("SELECT * FROM customer ORDER by d1")
or die(mysql_error());
echo "<select name=z6>";
echo "<option value=" . $z6 . "></option>";
while($row = mysql_fetch_array( $result )) {
echo "<option value=" . $row[d1] . ">" . $row[d1] . "</option>";
}
?>
</td><td>