Results 1 to 5 of 5

Thread: [RESOLVED]why only comes first word

  1. #1

    Thread Starter
    Hyperactive Member samsyl's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    338

    [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
    Last edited by samsyl; Sep 30th, 2006 at 05:54 PM.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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.
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Hyperactive Member samsyl's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    338

    Re: why only comes first word

    its working

    thank you

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width