PHP Arrays? Need PHP Help

Discussion in 'PHP' started by Pixel T., Dec 13, 2009.

  1. #1
    Hey guys,

    I have a personal project I'm working on and this is what I need help on.

    I have a page called settings.php. I want to set a page called settings.php?action=adduser which would pull up a form instead of the things I currently have on settings.php.

    I saw in a script once that someone was using arrays or something like that? If anyone can help me out or even just point me in the right direction, I will greatly appreciate it.

    If I'm not making any sense whatsoever, let me know and I will try to reword it.

    Thanks,
     
    Pixel T., Dec 13, 2009 IP
  2. CoreyPeerFly

    CoreyPeerFly Notable Member Affiliate Manager

    Messages:
    394
    Likes Received:
    24
    Best Answers:
    5
    Trophy Points:
    240
    #2
    Can you explain a little more about what you want settings.php to do?
     
    CoreyPeerFly, Dec 13, 2009 IP
    Pixel T. likes this.
  3. Pixel T.

    Pixel T. Well-Known Member

    Messages:
    1,205
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    170
    #3
    Well when you go to settings.php on the website, its a simple form that send data to a mySQL database. I want to create another form for adding an admin to the database but I don't want to create another file. I want it to be settings.php?action=addadmin or something like that.
     
    Pixel T., Dec 13, 2009 IP
  4. CoreyPeerFly

    CoreyPeerFly Notable Member Affiliate Manager

    Messages:
    394
    Likes Received:
    24
    Best Answers:
    5
    Trophy Points:
    240
    #4
    That's pretty easy.

    <?php
    	$action = $_GET['action'];
    	if($action == "addadmin")
    	{
    		// Add the add admin form here.
    	} else {
    		// Add the main form.
    	}
    ?>
    PHP:
     
    CoreyPeerFly, Dec 13, 2009 IP
  5. Pixel T.

    Pixel T. Well-Known Member

    Messages:
    1,205
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    170
    #5
    Ahhh...

    Thats exactly what I need. I had this code before but I just couldn't make it work.

    Thanks a lot bro :)
     
    Pixel T., Dec 13, 2009 IP