Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 5 12345 LastLast
Results 1 to 10 of 49
  1. #1
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default [PHP] Echo in an echo?

    PHP Code:
        echo "<form action=\"?do=update\" method=\"post\">
    first name: <input type=\"text\" name=\"firstname\" value=\"\" /><br />
    last name: <input type=\"text\" name=\"lastname\" /><br />
    nick name: <input type=\"text\" name=\"nickname\" /><br />
    location: <input type=\"text\" name=\"location\" /><br />
    email: <input type=\"text\" name=\"email\" /><br />
    gender: <input type=\"checkbox\" name=\"male\" /> male <input type=\"checkbox\" name=\"female\" /> female<br />
    bio: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"bio\" /><br />
    fav movies: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmovies\" /><br />
    fav music: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmusic\" /><br />
    fav books: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favbooks\" /><br />
    <input type=\"submit\" value=\"update profile\" />
    </form><br />
    <br />
    want to change your password?
    <form action=\"?do=updatepw\" method=\"post\">
    current password: <input type=\"password\" name=\"currentpassword\" /><br />
    new password: <input type=\"password\" name=\"newpassword\" /><br />
    <input type=\"submit\" value=\"update password\" />
    </form>"

    On the text inputs I want to add a value with an echo inside it, how would I do that? +rep

  2. #2
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    What do you mean? As in, in the boxes you get the data from the database and put that as the values?

    If you meant that try this:

    PHP Code:
    $profile mysql_query("SELECT * from users where username = '$logged[username]'");
    $profile mysql_fetch_array($profile);

    echo 
    "<form action=\"?do=update\" method=\"post\">
    first name: <input type=\"text\" name=\"firstname\" value=\"
    $user[name]\" /><br />
    last name: <input type=\"text\" name=\"lastname\" value=\"
    $user[lastname] /><br />
    nick name: <input type=\"text\" name=\"nickname\" value=\"
    $user[nickname] /><br />
    location: <input type=\"text\" name=\"location\" value=\"
    $user[location] /><br />
    email: <input type=\"text\" name=\"email\" value=\"
    $user[email] /><br />
    gender: <input type=\"checkbox\" name=\"male\" /> male <input type=\"checkbox\" name=\"female\" /> female<br />
    bio: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"bio\" value=\"
    $user[bio] /><br />
    fav movies: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmovies\" value=\"
    $user[favmovies] /><br />
    fav music: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmusic\" value=\"
    $user[favmusic] /><br />
    fav books: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favbooks\" value=\"
    $user[favbooks] /><br />
    <input type=\"submit\" value=\"update profile\" />
    </form><br />
    <br />
    want to change your password?
    <form action=\"?do=updatepw\" method=\"post\">
    current password: <input type=\"password\" name=\"currentpassword\" /><br />
    new password: <input type=\"password\" name=\"newpassword\" /><br />
    <input type=\"submit\" value=\"update password\" />
    </form>"

    Last edited by Blinger1; 16-11-2008 at 11:59 PM.

  3. #3
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    I'm not 100% sure what you mean, but couldn't you just put the text that you want to display into a variable, then add the variable into value?
    i.e.
    Code:
    <input type='text' value='$textHere' />

  4. #4
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Trinity: I tried that, gives me an error.

  5. #5
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    try what i suggested

  6. #6
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    You both suggested the same thing.

  7. #7
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    well what do you mean by 'add an echo inside it'?

  8. #8
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Exactly what you thought I meant, just what you gave me errored.

  9. #9
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    okay.
    It errored because i did it wrong

    PHP Code:
    $profile mysql_query("SELECT * from users where username = '$logged[username]'");
    $user mysql_fetch_array($profile); 
    try that instead of the:
    PHP Code:
    $profile mysql_query("SELECT * from users where username = '$logged[username]'");
    $profile mysql_fetch_array($profile); 

  10. #10
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    No, not the mysql codes, the code inside the form.

Page 1 of 5 12345 LastLast

Posting Permissions

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