string getting cut off

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

string getting cut off

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: string getting cut off

Post by requinix »

Because the one in the code doesn't put quotes around the value.

Code: Select all

<option value=testing one two three>
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: string getting cut off

Post by inosent1 »

perfect .... thanks!
Post Reply