Results 1 to 4 of 4

Thread: PHP $_GET Variable

  1. #1
    Join Date
    Apr 2005
    Posts
    46,704

    Default PHP $_GET Variable

    $_GET variable is used to collect values in a form with method="get".


    Example

    Code:
    <html>
    <body>
    <form action="" method="get">
    Name: <input type="text" name="fname" />
    Age: <input type="text" name="age" />
    <input type="submit" />
    </form>
    
    </body>
    </html> 
    
    Welcome <?php echo $_GET["fname"]; ?>.<br />
    You are <?php echo $_GET["age"]; ?> years old!
    Last edited by minisoji; 11-15-2011 at 06:27 AM.

  2. #2
    Join Date
    Apr 2005
    Posts
    46,704

    Default

    PHP $_POST Variable


    $_POST variable is used to collect values in a form with method="post".


    Example

    Code:
    <html>
    <body>
    <form action="" method="post">
    Name: <input type="text" name="fname" />
    Age: <input type="text" name="age" />
    <input type="submit" />
    </form>  
    
    </body>
    </html>  
    
    Welcome <?php echo $_POST["fname"]; ?>!<br />
    You are <?php echo $_POST["age"]; ?> years old.
    Last edited by minisoji; 11-15-2011 at 06:27 AM.

  3. #3
    Join Date
    Apr 2005
    Posts
    46,704

    Default

    Code:
    <html>
    <body>
    <form action="" method="get">
    Name: <input type="text" name="fname" />
    Age: <input type="text" name="age" />
    <input type="submit" />
    
    </form>
    </body>
    </html>  
    
    Welcome <?php echo $_REQUEST["fname"]; ?>!<br />
    You are <?php echo $_REQUEST["age"]; ?> years old.
    Last edited by minisoji; 11-15-2011 at 06:47 AM.

  4. #4
    Join Date
    Mar 2012
    Posts
    6

    Default

    Thankyou ^_^

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
  •