Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: PHP Start

  1. #11
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    No, that didnt work.

    Also, I have the following code, but when the text comes out $username just comes out ast $username.

    PHP Code:
    <?php
    // retrieve form data
    $username $_POST['username'];
    // check entered value and branch
    {
        echo 
    'You have now signed up as $username!';
        }
    ?>


    Selling DJ/Habbo layout, more info here.


  2. #12
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    i believe?
    PHP Code:
     <?php
    // retrieve form data
    $username $_POST['username'];
    // check entered value and branch
    {
        echo 
    'You have now signed up as '.$username.'!';
        }
    ?>
    Last edited by Colin-Roberts; 07-11-2007 at 12:58 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  3. #13
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    Change the line that says:
    if($email = @hotmail.com){
    to:
    if($email = "@hotmail.com"){

    You where missing off the "'s around the email, because you can't put plaintext in if statements if they're not wrapped in "'s.
    i've been here for over 8 years and i don't know why

  4. #14
    Join Date
    Jan 2007
    Location
    England, Uk, World, Universe,
    Posts
    1,012
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by adamFTW View Post
    No, that didnt work.

    Also, I have the following code, but when the text comes out $username just comes out ast $username.

    PHP Code:
    <?php
    // retrieve form data
    $username $_POST['username'];
    // check entered value and branch
    {
        echo 
    'You have now signed up as $username!';
        }
    ?>
    its:
    <?php
    // retrieve form data
    $username = $_POST['username'];
    // check entered value and branch
    {
    echo "You have now signed up as $username!";
    }
    ?>
    my sig ran away,

  5. #15
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>

    <?php
    if( $_POST["email"] && !empty($_POST["email"]) )
    {
        if( 
    preg_match("(\w+@[a-zA-Z_-]+?\.[a-zA-Z]{2,6})"$_POST["email"]) )
        {
            if( 
    preg_match("(\w+@hotmail+?\.[a-zA-Z]{2,6})"$_POST["email"]) )
            {
                echo 
    "Sorry we do not allow hotmail emails";
            } else
            {
                echo 
    'On to the next step....    
                <form action="username.php" method="post">
                Enter desired username:
                <br />
                <input name="username" size="20" type="text"><br />
                <input value="Submit" type="submit">
                </form>'
    ;
            }
        } else
        {
            echo 
    "You entered an invalid email";
        }
    } else
    {
        echo 
    "You didnt enter anything for your email";
    }
    ?> 

    </body>
    </html>
    Try that.

    And for username:

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>

    <?php
    if( $_POST["username"] )
    {
        echo 
    'You have now signed up as ' $username '!';
    }
    ?>

    </body>
    </html>
    Last edited by Blob; 07-11-2007 at 05:27 PM.

  6. #16
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    New error now.

    Error: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/habboboa/public_html/wlphp/new/reg.php on line 48

    Line 48:
    PHP Code:
    $query mysql_query("INSERT INTO `system` (`username`, `password`, `age`) VALUES ($username, '$password', '$age'"); 


    Selling DJ/Habbo layout, more info here.


  7. #17
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Does it have to do with the ; or ' or does it have to do with the variable itself?


    Selling DJ/Habbo layout, more info here.


  8. #18
    Join Date
    Nov 2006
    Location
    Cheshire.
    Posts
    730
    Tokens
    250

    Default

    PHP Code:
    $query mysql_query("INSERT INTO `system` (`username`, `password`, `age`) VALUES ('$username', '$password', '$age'"); 
    Try that.


    Give us an add like!

  9. #19
    Join Date
    Apr 2007
    Location
    england
    Posts
    536
    Tokens
    0

    Default

    Nope, didnt work.


    Selling DJ/Habbo layout, more info here.


  10. #20
    Join Date
    Nov 2006
    Location
    Cheshire.
    Posts
    730
    Tokens
    250

    Default

    Check the lines before incase you've missed an ; out.


    Give us an add like!

Page 2 of 3 FirstFirst 123 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
  •