user3127817
user3127817

Reputation: 3

PHP Re-submit form

I have a script that is activated when someone submits a form on that same page. The first time the user fills in data and presses submit, it works, the second time it does not respond.

NOTE: There is a second document where the sessions are created (SESSION_START is given).

<?php
      if ($_SERVER["REQUEST_METHOD"] == "POST")
{
    
    $_SESSION['aantalpogingen'] = $_SESSION['aantalpogingen'] + 1;
    echo $_SESSION['aantalpogingen'];
    echo "<br />";
    $_SESSION['poging'][$_SESSION['aantalpogingen']] = substr($_SESSION['hetwoord'] , 0 , 1)  . $_POST['PogingLetter2'] . $_POST['PogingLetter3'] . $_POST['PogingLetter4'] . $_POST['PogingLetter5'];
    

echo "<table width='450' height='75' border='1'>";

    foreach($_SESSION['poging'] as $pogingnr=>$gok)
    {
        if($gok != "")
        
        {
            echo "<tr>";
        
        
    
        echo "<th WIDTH='66'>";
        echo $gok[0] ;
        echo "</th>";
        
        echo "<th WIDTH='66'>";
        echo $gok[1] ;
        echo "</th>";
        
        echo "<th WIDTH='66'>";
        echo $gok[2] ;
        echo "</th>";
        
        echo "<th WIDTH='66'>";
        echo $gok[3] ;
        echo "</th>";
        
        echo "<th WIDTH='66'>";
        echo $gok[4] ;
        echo "</th>";
        
        echo "<th>";
        echo "Poging " . $pogingnr;
        echo "</th>";
        
        
        echo "</tr>";
        }
    }
    
    
    echo "  </table";
    

    
}
  ?>

I cannot find any syntax errors or anything, I hope you can help me :)

Upvotes: 0

Views: 165

Answers (1)

Jonny 5
Jonny 5

Reputation: 12389

I found at least one mistake :->

echo "  </table";

missing >

  if ($_SERVER["REQUEST_METHOD"] == "POST")

{

This condition meant to be for the not intended below too?

echo "<table width='450' height='75' border='1'>";

As it's not closed before the echo.

Upvotes: 1

Related Questions