Call external API in wordpress based on user input

I want to create a simple wordpress website in which I want to display a search box on a page. On searching a string in text/search box, an external API call should be made based on that string and the data returned by the API should be shown to user. I have successfully referred code from below URL so far – https://rapidapi.com/blog/integrate-external-api-wordpress/.

But I am not able to make a call to API based on string passed in text box. I have done below code so for in the child theme file page:-

<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>     <main id="main" <?php generate_do_element_classes( 'main' ); ?>>         <form action="" method="post">         Enter query:         <input type=text name="t1">         <br>         <br>         <input type=submit name="s">         <?php         /**          * generate_before_main_content hook.          *          * @since 0.1          */         do_action( 'generate_before_main_content' );          if(isset($  _POST['s'])){         echo "good";             $  curl = curl_init();          curl_setopt_array($  curl, [             CURLOPT_URL => "******API URL*****/".$  _POST['t1'],             CURLOPT_RETURNTRANSFER => true,             CURLOPT_FOLLOWLOCATION => true,             CURLOPT_ENCODING => "",             CURLOPT_MAXREDIRS => 10,             CURLOPT_TIMEOUT => 30,             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,             CURLOPT_CUSTOMREQUEST => "GET",             CURLOPT_HTTPHEADER => [                 "x-rapidapi-host: XYZ",                 "x-rapidapi-key: ABc"             ],         ]);          $  response = curl_exec($  curl);         $  err = curl_error($  curl);          curl_close($  curl);          if ($  err) {             echo "cURL Error #:" . $  err;         } else {             echo $  response;         }     }                           /**          * generate_after_main_content hook.          *          * @since 0.1          */         do_action( 'generate_after_main_content' );         ?>         </form>     </main> </div>  <?php /**  * generate_after_primary_content_area hook.  *  * @since 2.0  */ do_action( 'generate_after_primary_content_area' );  generate_construct_sidebars();  get_footer(); 

When I click on Submit button, it gives ‘Page not Found’.