Page 1 of 1

string getting cut off

Posted: Mon Jul 16, 2012 12:14 am
by inosent1
i am using the following code to pull items from the db to display in a drop down list

Code: Select all

<select name="intake_q1"  >
<option value="testing one two three" >testing one two three</option>
<? 
include 'dbinfo.inc.php'; 

if(isset($select)&&$select!="") { 

$select = $_GET['select']; 

} 

$list = mysql_query("SELECT * FROM dec_q ); 

while($row_list=mysql_fetch_assoc($list)) { 

$id =  $row_list['id']; 
$pillar = $row_list['pillar']; 
$question = $row_list['question']; 


echo '<option value='  . $question . '>'; 

echo $question; 

echo '</option>'; 


echo '</select>'; 
} 

?>


the first item from the db reads


"testing one two three"



but when i sumbit (before it gets to the DB) i see this

"testing"


and the rest of the sentence is cut off. so everything after the first word is lost.

but if i use the value in the first option it doesnt do that

why is the code that pulls from the db cutting the value off when the first option doesnt do that?

Re: string getting cut off

Posted: Mon Jul 16, 2012 12:35 am
by requinix
Because the one in the code doesn't put quotes around the value.

Code: Select all

<option value=testing one two three>

Re: string getting cut off

Posted: Mon Jul 16, 2012 1:08 am
by inosent1
perfect .... thanks!