Jump to content

Recommended Posts

You can do something like this:

 

<?PHP

//Get the install step from the URL
$step = $_GET['step'];
//Creating the name of the actual file to be included
$file = 'step' . $step . '.inc';

//Check that $step is set and that the file actually exists in your include dir
if(isset($step) && file_exists('include/'.$file)){

  include($file);

}
else{

  include('step1.inc');

}

?>

 

 

It will enable you to link like this: <a href="install.php?step=2>Step 2</a> and the file being displayed by following that link will be "step2.inc" which are placed in a folder called includes in the same folder as your install.php...

 

Easy as that

 

Link to comment
https://forums.phpfreaks.com/topic/40894-solved-is-this-simple/#findComment-198072
Share on other sites

<?php
//install.php

$step = $_GET['step'];

if($step == 1){
   //include file here
}elseif($step == 2){
   //include file here
}else{
   //display default stuff here
}

?>

but your link would have to be:

 

install.php?step=1

 

it's an oversimplification, but it should give you an idea of where to start.

Link to comment
https://forums.phpfreaks.com/topic/40894-solved-is-this-simple/#findComment-198074
Share on other sites

to add to everyone elses post, i'd use a switch statement:

<?php
        echo "<a href=\"index.php?step=1\">Step 1</a><br />\n";
        echo "<a href=\"index.php?step=2\">Step 2</a><br />\n";
        echo "<a href=\"index.php?step=3\">Step 3</a><br />\n";

        switch($_GET['step']){
                case '1':
                        include "page1.php";
                        break;

                case '2':
                        include "page2.php";
                        break;

                case '3':
                        include "page3.php";
                        break;

                default:
                        break;
        }
?>

Link to comment
https://forums.phpfreaks.com/topic/40894-solved-is-this-simple/#findComment-198081
Share on other sites

Man, everyone's mental i swear.

 

Steviez look up the GET command. It's very simple,

 

Like you do with POST you enter the form fields name within parenthesis.

 

$_GET['step'];

 

would print what was entered in the field "step".

 

For hyperlinking you wouldn't use this method.

 

Snooble

 

Link to comment
https://forums.phpfreaks.com/topic/40894-solved-is-this-simple/#findComment-198100
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.