cutepraba Posted April 22, 2012 Share Posted April 22, 2012 $name = $name . "<option value=". $row['name'] . ">" .$row['name'] . "</option>"; but the name is "Mr. Robert",it does have dot symbol...how to overcome? please help Quote Link to comment Share on other sites More sharing options...
cpd Posted April 22, 2012 Share Posted April 22, 2012 Just because your value has a dot it doesn't mean PHP will treat it as the concatenation symbol. It treats the value as, most likely, a string and the dot is part of that string... Quote Link to comment Share on other sites More sharing options...
Barand Posted April 22, 2012 Share Posted April 22, 2012 The problem is the space, not the dot. Enclose the value in single quotes. $name = $name . "<option value='". $row['name'] . "'>" .$row['name'] . "</option>"; Quote Link to comment Share on other sites More sharing options...
cpd Posted April 22, 2012 Share Posted April 22, 2012 Aw my bad, the lack of explanation threw me. Moreover you can do: $var = "Hello"; $var.= " World"; echo $var; // Hello World Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.