[RESOLVED]why only comes first word
I want to show a data in textbox from mysql database. it comes but only first word, say data is "istiaque choudhury"
it comes only "istiaque"
why?
code is
<input type="text" name="txtsellername" size=66 value=<?php echo($SellerInfo['SellerName']); ?>>
thanks for help
Re: why only comes first word
because you're not using quotes around a string that has spaces in it. if you want to enclose a string for submitting to a database/form/pretty much anything, you should always have quotes around it.
Also, you can shorten your <?php echo(); ?> to <?=$var;?> to echo commands out.
PHP Code:
<input type="text" name="txtsellername" value="<?=$SellerInfo['SellerName'];?>" size="66">
In my opinion, it's good practice to put quotes around all HTML values, ie instead of size=66, you might use size="66" instead. This way, you will always avoid these types of problems.
Re: why only comes first word
Re: why only comes first word
Quote:
Originally Posted by kows
Also, you can shorten your <?php echo(); ?> to <?=$var;?> to echo commands out.
Very bad idea. This relies on the short_tags feature being enabled, but many hosts nowadays disable it because it conflicts with the use of XML processing instructions in the non-code areas. The PHP team itself strongly discourages the use of short tags.
Re: why only comes first word
Quote:
Originally Posted by kows
In my opinion, it's good practice to put quotes around all HTML values, ie instead of size=66, you might use size="66" instead. This way, you will always avoid these types of problems.
And you will be XML-compatible, where there is no exception to enclosing attribute values.