Professional Web Applications Themes

Display variable with spaces - PHP Development

Hello, I am trying to display the rows of a MySql Query in a table. I retrieve the result using the query : while ($row = mysql_fetch_array($result1, MYSQL_ASSOC)) { $email_1 = $row["email_1"];

Thread: Display variable with spaces

Thread: Display variable with spaces

} And I try to display it in the table using this : <input name="email_1" type="text" id="email_1" size="50" value = <? echo "$email_1"; ?>>

Thread: Display variable with spaces

Thread: Display variable with spaces

if I try to echo the variable $email_1, I get the correct value i.e. "thisisa long e-mail address" /// However when it comes to displaying it using the table all I get is the "thisisa" . It simply avoids the spaces. Can anyone tell ...

  1. #1

    Default Display variable with spaces

    Hello,

    I am trying to display the rows of a MySql Query in a table. I
    retrieve the result using the query :


    while ($row = mysql_fetch_array($result1, MYSQL_ASSOC))
    {
    $email_1 = $row["email_1"];\0\0
    }

    And I try to display it in the table using this :
    <input name="email_1" type="text" id="email_1" size="50" value = <?
    echo "$email_1"; ?>>\0\0


    if I try to echo the variable $email_1, I get the correct value i.e.
    "thisisa long e-mail address"
    /// However when it comes to displaying it using the table all I get is
    the "thisisa" . It simply avoids the spaces. Can anyone tell me why
    this is happening..?? I am sure it is something pretty minor .... but I
    just cant seem to get it right.


    Thanks in advance,
    -Pushpinder
    Pushpinder Singh Garcha Guest

  2. #2

    Default Re: [PHP] Display variable with spaces

    On Wed, Aug 13, 2003 at 11:56:43AM -0400, Pushpinder Singh Garcha wrote:
    > <input name="email_1" type="text" id="email_1" size="50" value = <?
    > echo "$email_1";
    > /// However when it comes to displaying it using the table all I get is
    > the "thisisa" . It simply avoids the spaces. Can anyone tell me why
    You need to write valid HTML. Put quotes around the value. You don't
    need quotes around the variable. Plus, close the element, of course.

    <input name="email_1" type="text" id="email_1" size="50"
    value="<?php echo $email_1; ?>" />

    --Dan

    --
    FREE scripts that make web and database programming easier
    [url]http://www.ysisandsolutions.com/software/[/url]
    T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
    4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
    Analysis & Solutions Guest

  3. #3

    Default Re: [PHP] Display variable with spaces

    > And I try to display it in the table using this :
    > <input name="email_1" type="text" id="email_1" size="50" value = <?
    > echo "$email_1"; ?>>
    >
    > if I try to echo the variable $email_1, I get the correct value i.e.
    > "thisisa long e-mail address"
    > /// However when it comes to displaying it using the table all I get
    > is the "thisisa" . It simply avoids the spaces. Can anyone tell me why
    > this is happening..?? I am sure it is something pretty minor .... but
    > I just cant seem to get it right.
    You need to quote your value attribute.

    Larry

    Larry E . Ullman Guest

  4. #4

    Default Re: [PHP] Display variable with spaces -SOLVED

    Thank you so much ! it works fine now ;)

    --Pushpinder


    On Wednesday, August 13, 2003, at 12:01 PM, Larry E. Ullman wrote:
    >> And I try to display it in the table using this :
    >> <input name="email_1" type="text" id="email_1" size="50" value = <?
    >> echo "$email_1"; ?>>
    >>
    >> if I try to echo the variable $email_1, I get the correct value i.e.
    >> "thisisa long e-mail address"
    >> /// However when it comes to displaying it using the table all I get
    >> is the "thisisa" . It simply avoids the spaces. Can anyone tell me
    >> why this is happening..?? I am sure it is something pretty minor ....
    >> but I just cant seem to get it right.
    >
    > You need to quote your value attribute.
    >
    > Larry
    >
    >
    > --
    > PHP General Mailing List ([url]http://www.php.net/[/url])
    > To unsubscribe, visit: [url]http://www.php.net/unsub.php[/url]
    >
    Pushpinder Singh Garcha Guest

Similar Threads

  1. how to display a javascript variable value
    By BIZ_CF in forum Macromedia ColdFusion
    Replies: 11
    Last Post: June 13th, 09:29 AM
  2. How do I display a variable in a variable?
    By moyerc in forum Coldfusion Database Access
    Replies: 5
    Last Post: June 5th, 06:08 PM
  3. How do I display the name of a variable?
    By Randell D. in forum PHP Development
    Replies: 2
    Last Post: September 24th, 06:16 PM
  4. How to replace variable spaces with a tab - Please Help
    By Perlwannabe in forum PERL Beginners
    Replies: 2
    Last Post: September 6th, 11:47 PM
  5. Perl variable "leading white spaces" Please help
    By \Dandy\ Randy in forum PERL Miscellaneous
    Replies: 2
    Last Post: July 21st, 12:33 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
  •