Jump to content
xisto Community
demonlord

2 Pages Into One how?

Recommended Posts

Hello, now this may be a stupid question but i'm very new to php so i need some help. what i'm wanting to do is combine 2 pages in to one. like for example the install.php for invisionpower board it starts with one page and you click continue and it gives you a whole new page but if you look at the url you are still using the install.php file but it has somethinglike "?a=2" at the end. how can i do this. Thanks

Share this post


Link to post
Share on other sites

You can control what gets processed in index.php by taking the tagged get variables at the end of the URL and using it in your code.For example if you have a file called index.php

<?php$do = $_GET['do'];if($do == 'option1'){ // do what ever you need to be done here}else if($do == 'option2'){  // do what ever you need to be done here}?>?>

so now you can make links that go to index.php and add controls to it by adding to the end of the URLi.e index.php?do=dothis

Edited by sonesay (see edit history)

Share this post


Link to post
Share on other sites

I was in your shoes a few years ago, I ended up buying a book and went through the tutorials in them. It helped but then I was way to busy and never even did any PHP for a year or 2 and then I never progressed. The only advice I can give you is keep doing it. Thats how I improved, You know the old saying hard work really pays off and it does. You may not pick it up in a few days/weeks/months but you will pick it up eventually. And also if your stumped you can always post here.Good luck.

Share this post


Link to post
Share on other sites

after i started this topic i actuly went out and got some books on php and i'm going to sit down and go through them and make a whole lot of notes so hopefuly that will help.and thanks again for the help

Share this post


Link to post
Share on other sites

Here is a link to a Tutorial I wrote some time ago. Back when I was just starting out learning some php. I would do things a little differently now, but it might assist you with the task you face.
Any questions, just post them to that thread, please.

http://forums.xisto.com/topic/35271-templating-system-using-php-includes-building-a-dynamic-site-using-includes-and-flat-files/

Share this post


Link to post
Share on other sites

sonesay i have one more question about the scriptwhere do i put the code that i want to show up if $do is Null for example if i name the script act.php where would i put the code that they would see if they went to act.php instead of act.php?z=whatever.Thanks

Share this post


Link to post
Share on other sites

sonesay i have one more question about the script
where do i put the code that i want to show up if $do is Null for example if i name the script act.php where would i put the code that they would see if they went to act.php instead of act.php?z=whatever.

Thanks



{
// do what ever you need to be done here
}
else if($do == 'option2')
{
// do what ever you need to be done here
}
else
{
// the previous 2 checks didn't match do this section of code
}
linenums:0'>if($do == 'option1'){// do what ever you need to be done here}else if($do == 'option2'){// do what ever you need to be done here}else{// the previous 2 checks didn't match do this section of code}
You can add more else if checks if needed but its too hard to cover all possibilities so if none match you can add a final statement of else at the bottom and it will execute if none of the above checks are true.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.