在PHP中形成第一次输入后从数据库中获取的数据

I've to create a form in PHP. This form, after that a first part of the required data is written by the user, has to take other data from the database and prefilled in some of the field of the second part of the form, before than the full form is sent.

To do this, I'm working with php if-else, and I'll send a form with only the first field at the beginning, then I'll fetch data from mySql database using that field and show the entire form.

For me, reloading a page is not a problem, so I'd prefer to not use AJAX if possible.

Is it fine, from both a logical and performances point of view, to do this in this way?

I'll omit the part regarding the connection with the database.

<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
    <div>
    <label for="first_data">First data <strong>*</strong></label>
    <input type="text" name="first_data">
    <input type="hidden" name="verify" value="1">
    </div>

   <?php
       if ($_POST['verify']!=1){
            echo '<input type="submit" name="submit" value="Send"></form>';
       }
       else{
            //continue with the remaining part of the form
       }
   ?>

Its fine to do it this way though i do take issue with how you have your "view" is set up. It makes more sense to have all the common elements of the form and then is if/else for the non-common elements:

<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
    <div>
        <label for="first_data">First data <strong>*</strong></label>
        <input type="text" name="first_data">
        <input type="hidden" name="verify" value="1" />
    </div>
    <?php if ($_POST['verify'] != 1): ?>
      <input type="submit" name="submit" value="Send">
    <?php else: ?>
       <!-- output the other fields -->
    <?php endif; ?>
</form>