New to php

Discussion in 'PHP' started by Serangan, Jan 30, 2008.

  1. #1
    Hi, this is sorta hard to explain but ill give it ago.

    How do i have;

    index.php?action={name}

    Ive used the google, but i can phrase it right to get it.

    Any help appreciated


    Serangan
     
    Serangan, Jan 30, 2008 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Use the $_GET global variable.
    
    $action = $_GET['action'];
    
    PHP:
     
    Kaizoku, Jan 30, 2008 IP
  3. angilina

    angilina Notable Member

    Messages:
    7,824
    Likes Received:
    186
    Best Answers:
    0
    Trophy Points:
    260
    #3
    here is a example

    www.xxxxxxxx.com/index.php?a=1

    now in ur index file use this code to get the variable a

    <?php
    $q=$_GET['a'];
    if (a=1){}

    else ....
    ?>

    what exactly r u trying to do?
     
    angilina, Jan 30, 2008 IP
  4. seoyo

    seoyo Peon

    Messages:
    17
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You may do the following in case the var is sent via POST. This will pick up both POST and GET value for 'action'.

    $action = $_REQUEST['action']
     
    seoyo, Jan 30, 2008 IP
  5. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #5
    Using $_REQUEST will cause inconsistency.
     
    Kaizoku, Jan 30, 2008 IP
  6. Serangan

    Serangan Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Im just learning php, and i was interested in this, cause ive seen it done on lots of sites and didnt know how it was done.
     
    Serangan, Feb 7, 2008 IP
  7. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #7
    shallowink, Feb 7, 2008 IP