Hi guys ,
I am searching for the past few hours for a solution and i cannot find .
I am building a website and on a page i have a search box like you can see in the photos .

This is the code for the field

<form action="?id=tracking" method="post" class="sky-form">
<section>
<label class="label"></label>
</section>
<section>

  <h3>SEARCH HERE  </h3>
  <h7 id="xxxnot" style="color:#FF0000; padding-left:3px;"> </h7>
</section>
<section>
  <label class="input"> <i class="icon-append icon-tag"></i>
  <input size="35" id="samplees" type="text" name="samplees" required="required">
  </label>

</section>
<input type="submit" name="gbs_submit" value="Search !" id="gbs_submit" class="button validate">
</form>

How can i edit it so when i search for example 111 to redirect to 111.php ( a specific file ) , or if i enter 222 to redirect to 222.php file ?
Thank you

    Probably depends on a few things, such as:

    • Is it just for "111" and "222", or other values, too?
    • If other values, how do you know which ones have relevant file?
    • If the value is not a valid file reference, what should happen (another type of search, an error message,...)?
    • Is there already a block of PHP code that handles this form's submission? You'll probably want to add this functionality to that code, though maybe it could be handled in JavaScript on the web page if the logic allows it (i.e. the first bullet).

    NogDog There will be other values ( php pages ) , the files will be created manually ,
    for example i create a php page with the name 1111.php , when someone enters 1111 , to show the 1111.php page .
    If i create another page with the name 2222.php , who ever enters 2222 to show the 2222.php page

      Based on that, I'm working under the assumption then that the search is only to find one of those files and send the user to it. If so, then maybe something like...

      <?php
      // note: absolutely nothing must go before that opening <?php tag
      if(!empty($_POST['samplees'])) {
          $fileName = basename(trim($_POST['samplees']).'.php';
          $fileDir = __DIR__.'/samplees/'; // change to wherever the files are relative to this one
          if(file_exists($fileDir.$fileName)) {
              // change as needed to point to the correct directory
              header('Location: https://your.domain.com/samplees/'.$fileName);
              exit; // we're all done here
          } else {
              $error = "File '$fileName' not found.";
          }
      }
      ?>
      <!-- your HTML stuff starts here -->
      <!-- somewhere where it makes sense in the HTML: -->
      <?php
      if(!empty($error)) {
          echo "<p class='error'>$error</p>";
      }
      ?>
      <!-- rest of HTML -->
      
        Write a Reply...