SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up text box problem

    hi

    i am taking the value from database and showing it in text box.now if it is a single word it is ok but if it value is more than two words only first word is showing and other is not showing. e.g if value is 'new chapter' then only 'new' is showing and not 'chapter'. wht can be the problem?
    its urgent plzzz.....
    regards
    phphelp

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you putting quotation marks around the value?
    HTML Code:
    <input type="text" value="<?php echo $value; ?>">
    You must also make sure that there are no double quotes in the value, e.g. by using
    PHP Code:
    htmlspecialchars($valueENT_NOQUOTES
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no actually i m doing like this and no quotation marks in value

    <input name="title" type="text" class="taho-11-bule-textfeild" size="35" dir="rtl"
    <?
    if(isset($_POST['checker']))
    {
    echo("value=".$title);
    }
    else
    {
    echo("value=".$query2[1]);
    }
    ?>
    >
    its urgent plzzz.....
    regards
    phphelp

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <input name="title" type="text" class="taho-11-bule-textfeild" size="35" dir="rtl"
     value="<?php
     echo (isset($_POST['checker']) ? htmlspecialchars($title) : htmlspecialchars($query2[1]);
    ?>">
    Simon Pieters

  5. #5
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    UK, London
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, a strip_slashes() is also needed.
    Chris Heilmann
    Blog | Articles | Binaries

  6. #6
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but it i sgiving some parser error dear.????????
    its urgent plzzz.....
    regards
    phphelp

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need the quotation marks in the generated markup. In fact, you should always use them (and make sure that there are no unescaped quotation marks in the content). Especially if you retrieve values from a database.

    Without the quotes, the generated markup will look like this:
    HTML Code:
    <input ... value=new chapter>
    This means the INPUT element's value attribute will be "new", and there'll be an invalid "chapter" attribute without a value.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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