Jump to content

php including 2 pages


aytac

Recommended Posts

Hey all,

 

I've a problem with including of my pages.

When I do choose lotto on index.php , I do get the page and also can choose how many roster I want.

But I can't see my lotto results, because it does refresh to the index.php again.

How can I fix this problem ?

 

this is the code of index.php:

<?php
        echo '<table class="achtergrond" border="1">';
        echo '<tr><td colspan="3">';
        /* Keuzelijst tonen */
        echo '<center><form action="'.$_SERVER['php_self'].'" method="POST"><select name="test">';
        echo '<option selected>Kies een formulier</option></center>';
        echo '<option value="1">Lotto</option>';
        echo '<option value="2">Euromillions</option>';
        echo '</select>';
        echo '<button type="submit" name="knop">OK</button>';
        echo '</form>';
        echo '</td></tr>';
            /* Als er op de knop gedrukt is , voer het lottoformulier uit*/
           if(isset($_POST['knop']))
           {
                  echo '<tr><td>';
                  echo $waarde;
                  /* variabel $waarde een waarde insteken via keuzelijst  */
                  switch($_POST['test'])
                  {
                      case 1;
                          include('formulieren/lotto.php');
                      case 2;
                          include('formulieren/euromillions.php');
                  }
                  echo '</td></tr>';
                  echo '</table>';

           }          
        ?>

 

 

and this is the code of lotto.php:

<?php
    echo '<table class="achtergrond">';
    echo '<tr><td colspan="3">';
    /* Keuzelijst tonen */
        echo '<center><form action="'.$_SERVER['php_self'].'" method="POST"><select name="lotto">';
        echo '<option selected>Kies aantal rooster</option></center>';
        echo '<option value="1">2 roosters</option>';
        echo '<option value="2">4 roosters</option>';
        echo '<option value="3">6 roosters</option>';
        echo '<option value="4">8 roosters</option>';
        echo '<option value="5">10 roosters</option>';
        echo '<option value="6">12 roosters</option>';
        echo '</select>';
        echo '<button type="submit" name="knop1">OK</button>';
        echo '</form>';
    echo '</td></tr>';
    /* Als er op de knop gedrukt is , voer het lottoformulier uit*/
   if(isset($_POST['knop1']))
   {
          /* variabel $waarde een waarde insteken via keuzelijst  */
          switch($_POST['lotto'])
          {
                case 0;
                   $waarde2 = 0;
                   break;
                case 1;
                   $waarde2 = 1;
                   break;
                case 2;
                   $waarde2 = 2;
                   break;
                case 3;
                   $waarde2 = 3;
                   break;
                case 4;
                   $waarde2 = 4;
                   break;
                case 5;
                   $waarde2 = 5;
                   break;
                case 6;
                   $waarde2 = 6;
                   break;
          }...

 

 

Link to comment
https://forums.phpfreaks.com/topic/220235-php-including-2-pages/
Share on other sites

$_SERVER['php_self'] doesn't exist, unless you've defined it yourself. $_SERVER['PHP_SELF'] is the correct variable name, but it shouldn't be used to submit a form to itself anyhow, as it presents a known XSS vulnerability.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.