php会话和不同的页面浏览量[关闭]

I'm trying to solve a php exercise and I got no clue how to display different parts of the website. I know you can include other pages(.php) with using switch.

Basically, if you visit site first time, you will see message: Children are bored, take them to park(link) , after pressing the link you will get into park view and it's message is displayed with ball picture and three child's picture. If you click on ball, one child's(chosen randomly) will get a 1 catch and you will be taken back into home/default view. Catches will be saved in session, so if you go back into park, you will see who caught the ball and you can repeat the process. Can you give me some tips how to do it? Thanks

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>

    <style>
    #children {
        float:left;
        margin: 0px 100px;
    }
    #ball {
        margin:100px;
    }
    </style>
    </head>
    <body>

    <!-- Use this to make different page views -->

    <!-- home -->
    <p>Children are bored, take them to <a href="?mode=park">park</a></p>

<!-- park -->
<p>For children to be more fun, throw them a ball, you can also go <a href="?mode=home">back home</a></p>
<div id="children">
    <!-- Repeat this part to make 3 children -->
    <div>
        <img src="child.png" alt="child" width="100"/><br/>
        here child's name -  here amount of balls child has caught.
    </div>
    <!-- end -->
</div>
<div id="ball">
    <a href="?mode=throw">    <!--after throwing,  add 1 catch to random child and return home page-->
        <img src="ball.png" width="100" alt="ball" />
    </a>
    </div>



    </body>
    </html>
<?php
session_start();
$_SESSION['counter']++;

if($_SESSION['counter'] > 0 && $_SESSION['counter'] < 5) {
    // Blah
}else if($_SESSION['counter'] > 5 && $_SESSION['counter'] < 10) {
    // Blah
}

Start the session -> Increase session variable by one(for page view) -> depending on value of the variable it does different things

EDIT:

if($_SESSION['mode'] == "park") {
    echo "<park image>";
}else if($_SESSION['mode'] == "city") {
    echo "<city image>";
}else {
    echo "<default image>";
}

Change these two concepts to fit what your trying to achieve.

<?php
session_start();

if($_GET['child'] == null){
// set a counter for each child for one time only.
$_SESSION['counter'] = array(1 => 0, 2 => 0, 3 => 0); 
}

if($_GET['child'] != null){
  $childIndex = $_GET['child'];
  $_SESSION['counter'][$childIndex]++;
}

$_prob = rand(1, 3);    // set probability for choosing the child image every time the page is loading. 


?>

// in the ball tag you can insert the increment within that using javascript . something like: 

<div id="ball">
    <a href="?mode=throw">    
    <!--after throwing,  add 1 catch to random child and return home page-->
        <img src="ball.png" width="100" alt="ball" onclick="increment(<?php echo $_prob; ?>);"/>
    </a>
 </div>
<script>
  function increment(prob){
     window.location="yourlink?child="+prob;
  }
</script>