#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    I'm using php to fill a form before I send it to a user. My problem is that following code generates many lines of spaces before the contents of $dietary -variable. I have tried but I cantīt find any solution.

    What I must do?

    <p align="left"><textarea rows="2" name="dietary" cols="60">
    <?php
    echo(trim($dietary));
    ?>
    </textarea></p>

    Pertti
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Pune, Maharashtra, India
    Posts
    86
    Rep Power
    14
    What i think is that UR code is fine but there may be the problem with the variable value assigning. Tell about the variable $dietary where u r takng from then only I can help you.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    The value of $dietary is first entered to a mySQL-database and when the user comes back he/she can see data again.

    Data seems to be right in the database.

    The form works fine when I use text field:

    <input type="text" name="dietary" size="65"
    <?php
    echo("value = '$dietary'");
    ?>
    >

    but when I view generated html code there is plenty of spaces before keyword VALUE.
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    The problem is that you are echoing on a seperate line so when generated you end up with a lot of whitespace. Do this:

    <input type="text" name="dietary" size="65" value="<?php print $dietary ?>">

  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    The problem really was that I was echoing on a seperate line, which generated lot of whitespace.

    Thank you for your help.

Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 12:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  3. fread problem: doesn t compile php code
    By ghorghor2002 in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 05:25 AM
  4. Wierd problem inserting data with VB6
    By gregquinn in forum MySQL Help
    Replies: 5
    Last Post: February 2nd, 2004, 07:37 AM
  5. Session Variable problem :(
    By modesty in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 04:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo