Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Mar 2010
    Location
    Orlando, FL
    Posts
    154
    Thanks
    2
    Thanked 8 Times in 8 Posts

    Exclamation This script isn't working and I don't know why

    Here's the scoop. I made this html/php script and the php portion doesn't seem to be working. Any reasons why? It's saved as a .php file. The file's name is basicForm.php so the action="basicForm.php" is telling it to go to itself.


    Code:
    <html>
    <head>
    <title>A BASIC HTML FORM</title>
    <?php
    $username=$_post['username'];
    print($username);
    ?>
    </head>
    <body>
    
    <form name="form1" method="post" action="basicForm.php">
    
    <input type="text" value="username">
    <input type="submit" name="submit1" value="Login">
    
    </form>
    </body>
    </html>

  • #2
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try first
    Code:
    <html>
    <head>
    <title>A BASIC HTML FORM</title>
    </head>
    <body>
    
    
    <?php
    $username=$_post['username'];
    print($username);
    ?>
    
    
    
    <form name="form1" method="post" action="basicForm.php">
    
    <input type="text" value="username">
    <input type="submit" name="submit1" value="Login">
    
    </form>
    </body>
    </html>

  • #3
    Regular Coder
    Join Date
    Mar 2010
    Location
    Orlando, FL
    Posts
    154
    Thanks
    2
    Thanked 8 Times in 8 Posts
    Nope. It didn't work.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to have a name attribute on the input.
    PHP Code:
    <input type="text" name="username" value="username"
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Nov 2009
    Location
    Phoenix
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    That should work. You need to assign the value to a POST variable. You probably also want to change value="", otherwise you are assigning "username" as the default value.

  • #6
    Regular Coder
    Join Date
    Mar 2010
    Location
    Orlando, FL
    Posts
    154
    Thanks
    2
    Thanked 8 Times in 8 Posts
    None of those are working. Got anything else?

  • #7
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    PHP Code:
    <html>
    <head>
    <title>A BASIC HTML FORM</title>
    </head>
    <body>


    <?php

    echo $_POST['username'];

    ?>



    <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    <input type="text" value="username" name="username" />
    <input type="submit" name="submit1" value="Login" />

    </form>
    </body>
    </html>
    If this doesn't work, check if PHP is actually installed.
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]

  • #8
    Regular Coder
    Join Date
    Mar 2010
    Location
    Orlando, FL
    Posts
    154
    Thanks
    2
    Thanked 8 Times in 8 Posts
    It works! Thanks everyone!


  •  

    Posting Permissions

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