...

View Full Version : switch between two includes on condition



ska_defender
07-29-2012, 04:07 PM
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 ?

DrDOS
07-29-2012, 04:56 PM
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 .

ska_defender
07-29-2012, 08:03 PM
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 ?

DrDOS
07-29-2012, 10:15 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum