Professional Web Applications Themes

Problem with HTML Text box and PHP variable. - PHP Development

I am having a problem with rendering PHP variables in an HTML text box. If the value of $myString is "Hello" the line below will render it correctly echo "<td><input type=text name=value".$j.$i." size=20 value=".$myString."></td>"; However if the value of $myString is "Hello 1" then the line above will populate the text box with only "Hello" and it will loose the "1" If I change the problem line to the following: echo "<td>".$myString."</td>"; I don't have a problem. "Hello 1" will be rendered correctly. But then I don't have a text box to edit the value. Please help. Thanks Moiz...

  1. #1

    Default Problem with HTML Text box and PHP variable.

    I am having a problem with rendering PHP variables in an HTML text box. If the value of $myString is "Hello" the line below will render it correctly
    echo "<td><input type=text name=value".$j.$i." size=20 value=".$myString."></td>";

    However if the value of $myString is "Hello 1" then the line above will populate the text box with only "Hello" and it will loose the "1"

    If I change the problem line to the following:

    echo "<td>".$myString."</td>";

    I don't have a problem. "Hello 1" will be rendered correctly. But then I don't have a text box to edit the value. Please help.

    Thanks
    Moiz
    Moiz M Golawala Guest

  2. #2

    Default Re: [PHP] Problem with HTML Text box and PHP variable.

    try closing the value sections with single quotes that way the html
    processiing can see the value
    it was
    echo "<td><input type=text name=value".$j.$i." size=20
    value=".$myString."></td>";


    now is
    echo "<td><input type=text name=value'".$j.$i."' size=20
    value='".$myString."'></td>";

    ----- Original Message -----
    From: "Golawala, Moiz M (IndSys, GE Interlogix)" <Moiz.Golawalage.com>
    To: <php-generallists.php.net>
    Sent: Thursday, September 11, 2003 10:05 AM
    Subject: [PHP] Problem with HTML Text box and PHP variable.


    I am having a problem with rendering PHP variables in an HTML text box. If
    the value of $myString is "Hello" the line below will render it correctly
    echo "<td><input type=text name=value".$j.$i." size=20
    value=".$myString."></td>";

    However if the value of $myString is "Hello 1" then the line above will
    populate the text box with only "Hello" and it will loose the "1"

    If I change the problem line to the following:

    echo "<td>".$myString."</td>";

    I don't have a problem. "Hello 1" will be rendered correctly. But then I
    don't have a text box to edit the value. Please help.

    Thanks
    Moiz

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    Chris Sherwood Guest

  3. #3

    Default Re: [PHP] Problem with HTML Text box and PHP variable.

    This will help you

    <?php
    $dins="Dinesh";
    echo "<input type=text name=dins class='textbox' value='$dins' >";
    ?>

    -Murugesan


    ----- Original Message -----
    From: "Golawala, Moiz M (IndSys, GE Interlogix)" <Moiz.Golawalage.com>
    To: <php-generallists.php.net>
    Sent: Thursday, September 11, 2003 10:35 PM
    Subject: [PHP] Problem with HTML Text box and PHP variable.


    I am having a problem with rendering PHP variables in an HTML text box. If
    the value of $myString is "Hello" the line below will render it correctly
    echo "<td><input type=text name=value".$j.$i." size=20
    value=".$myString."></td>";

    However if the value of $myString is "Hello 1" then the line above will
    populate the text box with only "Hello" and it will loose the "1"

    If I change the problem line to the following:

    echo "<td>".$myString."</td>";

    I don't have a problem. "Hello 1" will be rendered correctly. But then I
    don't have a text box to edit the value. Please help.

    Thanks
    Moiz

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php
    Murugesan Guest

  4. #4

    Default Re: [PHP] Problem with HTML Text box and PHP variable.

    From: "murugesan" <mukeshgcthotpop.com>

    > This will help you
    >
    > <?php
    > $dins="Dinesh";
    > echo "<input type=text name=dins class='textbox' value='$dins' >";
    > ?>
    Use double quotes for HTML attributes.

    ---John Holmes...
    Cpt John W. Holmes Guest

  5. #5

    Default Re: [PHP] Problem with HTML Text box and PHP variable.

    Why do you say that?

    Jim Lucas
    ----- Original Message -----
    From: "CPT John W. Holmes" <holmes072000charter.net>
    To: "murugesan" <mukeshgcthotpop.com>; "Golawala, Moiz M (IndSys, GE
    Interlogix)" <Moiz.Golawalage.com>; <php-generallists.php.net>
    Sent: Thursday, September 11, 2003 11:56 AM
    Subject: Re: [PHP] Problem with HTML Text box and PHP variable.

    > From: "murugesan" <mukeshgcthotpop.com>
    >
    >
    > > This will help you
    > >
    > > <?php
    > > $dins="Dinesh";
    > > echo "<input type=text name=dins class='textbox' value='$dins' >";
    > > ?>
    >
    > Use double quotes for HTML attributes.
    >
    > ---John Holmes...
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    Jim Lucas Guest

  6. #6

    Default Re: [PHP] Problem with HTML Text box and PHP variable.

    A horsie named Cpt John W. Holmes demonstrated surprising intelligence and
    its ability to use morse code on Thu, 11 Sep 2003 13:56:21 -0500 when
    it tapped <00a701c37896$69b67aa0$a629089bTBHHCCDR> with its hoof:
    > From: "murugesan" <mukeshgcthotpop.com>
    >
    >
    >> This will help you
    >>
    >> <?php
    >> $dins="Dinesh";
    >> echo "<input type=text name=dins class='textbox' value='$dins' >";
    >> ?>
    >
    > Use double quotes for HTML attributes.
    >
    > ---John Holmes...
    Why? HTML 4.01 allows for both double, single and no
    quotation marks:

    [url]http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2[/url]

    Gary Petersen Guest

Similar Threads

  1. Problem with body text extraction with HTML::Pr
    By Perl_user in forum PERL Modules
    Replies: 3
    Last Post: November 9th, 12:49 AM
  2. HTML <Href Link inside a form (HTML text box)
    By Lingodude in forum Coldfusion Database Access
    Replies: 1
    Last Post: February 15th, 08:31 AM
  3. Dynamic text - html list problem
    By tvspec in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: May 20th, 07:54 PM
  4. Converting PDF to HTML...text problem
    By Heather_O_Taylor@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 1
    Last Post: May 11th, 06:05 PM
  5. [PHP] Problem with HTML Text box and PHP variable.
    By Warren Vail in forum PHP Development
    Replies: 3
    Last Post: September 12th, 11:09 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139