How to open/close Post/Get forms inside of if-statements?

Viewed 20

I am supposed to create a "website" where Get/Post are both used on the same page. I am currently stuck with a code looking like this :

if (!isset($_GET['init']))
{ 
    echo '<form method="GET" action="'.$_SERVER['PHP_SELF'].'">'; 
    Input::inputcreator() ;
    if (($_SERVER['REQUEST_METHOD'] === 'GET') && (!empty($_GET["start"])) && (!empty($_GET["end"])))
    {  
        DataInsertor::Init();    
        echo '</form>';
        if (!isset($_POST['show'])) {
            echo '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; 
            echo "test";
        }
    }  
  }   

I am not getting any fatal errors etc., but I am simply unable to close the GET form inside the if statement in order to open my Post statement to continue with my query.. (Note:

  • DataInsertor --> collects data from get forms and sends it inside my db --> working fine ;
  • Inputcreator --> is generating my input fields--> working fine
  • <form method="POST" --> not working at all
  • </form is also not working
0 Answers
Related