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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    25
    Thanks
    3
    Thanked 0 Times in 0 Posts

    switch between two includes on condition

    Hello
    I want to have 4 files
    index.php
    go1.php
    go2.php
    admin.php

    in admin.php I want a switch command to switch between go1.php and go2.php
    for example in admin.php there must be two buttons go1 and go2 when I click on go1 index.php will behave as go1.php and when I click on go2 index.php will behave as go2.php

    any tutorial or easy way to do this ?

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,915
    Thanks
    15
    Thanked 227 Times in 227 Posts
    This isn't very difficult at all, just simple conditional statements required, the only thing that is important is to implement it at the right place and time on the page, before it's needed .

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    25
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    This isn't very difficult at all, just simple conditional statements required, the only thing that is important is to implement it at the right place and time on the page, before it's needed .
    any tutorial to start with ?

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,915
    Thanks
    15
    Thanked 227 Times in 227 Posts
    It's going to have to be done with form, you could have go1 be a default when the page loads, then check a radio button for go2 and submit the
    form, to go back to go1, check it's radio button and submit. Then inside of the php $_POST part of the script put the include statement or the value for the include statement wherever you want it on the page. So you need a !isset statement for the default and an isset statement to wrap the $_POST in. Alternatively, you could use $_GET and make links with different URLs, index.php?goto=go1, but get isn't as secure.

  • Users who have thanked DrDOS for this post:

    ska_defender (07-30-2012)


  •  

    Posting Permissions

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