Form sending only partial option value
Posted: Thu Nov 17, 2011 5:13 pm
Hi
I'm building a selection form where options are read from a database.
In one part of the form I need the user to make a selection upon which I send the page back to itself in order to refresh some options.
The problem is only that the option sent back is cut of the value is a string with spaces
Here is the code
What happens is that if one of the selection values is like Terran Army only Terran will be sent back. How do I make sure Terran Army is stored into p1side and not only Terran?
If I try this with standard html option code it works fine. This got me confused.. Thanks for any feedbacks.
I'm building a selection form where options are read from a database.
In one part of the form I need the user to make a selection upon which I send the page back to itself in order to refresh some options.
The problem is only that the option sent back is cut of the value is a string with spaces
Here is the code
Code: Select all
<form name="side" method="post" action="challenge.php?soldierid=<?php echo $sid ?>&game=<?php echo $game ?>">
Your Side:
<select name="p1side" onchange="document.getElementById('sendside').click()">
<?php
if($game !="" or $side == "Select")
{
$result = mysql_query("SELECT * FROM gameside where game = '$game' or game = 'all'");
while ($row = mysql_fetch_array($result))
{
if ($row['side'] == $side)
{
echo "<option value= " . $row['side'] . " selected = ". $side .">" . $row['side'] . "</option>";
}
else
{
echo "<option value= " . $row['side'] . ">" . $row['side'] . "</option>";
}
}
}
?>
</select>
<input id="sendside" type="submit" name="submit" value="Challenge" style="visibility:hidden">
</form>
If I try this with standard html option code it works fine. This got me confused.. Thanks for any feedbacks.