How to auto fill other fields if data is already present in database?

I am developing a order form what is required manually input all fields even if data is present in database. But if data is already once added of a customer, how I can auto fill other fields as soon as phone number is inserted? when phone number is the unique customer id? if not found in database, all fields will be manually inserted…

here is the input form looks like

First of all don’t post pictures and show some code or HTML in the comment using the </> thing ma jig.
Second, an HTML form is just a way for the user to input his or her information in so that the programing script (PHP or some other server-side programming language) can process it.

Here a form where I enter comment in my own content management system (CMS).

<form id="formData" class="form_classes" action="create.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="cms[user_id]" value="3">
    <input type="hidden" name="cms[author]" value="John Smith">
    <input type="hidden" name="action" value="upload">
    <input class="form_image_upload_style" type="file" name="image">
    <label class="heading_label_style" for="heading">Heading</label>
    <input class="enter_input_style" id="heading" type="text" name="cms[heading]" value="" tabindex="1" required
    <label class="text_label_style" for="content">Content</label>
    <textarea class="text_input_style" id="content" name="cms[content]" tabindex="2"></textarea>
    <button class="form_button" type="submit" name="submit" value="enter">submit</button>

it is processed by a php script and here’s a very small chunk of it:

if (isset($_POST['submit'], $_FILES['image'])) {
    $data = $_POST['cms'];
    $errors = array();
    $exif_data = [];
    $file_name = $_FILES['image']['name']; // Temporary file for thumbnails directory:
    $file_size = $_FILES['image']['size']; // Temporary file for uploads directory:
    $file_tmp = $_FILES['image']['tmp_name'];
    $thumb_tmp = $_FILES['image']['tmp_name'];
    $file_type = $_FILES['image']['type'];
    $file_ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION));

     * Set EXIF data info of image for database table that is
     * if it contains the info otherwise set to null.
    if ($file_ext === 'jpeg' || $file_ext === 'jpg') {
    // more code....

I hope this clarifies it a little?

Oh, to answer you question you would need an update script of some kind.

You could do it using an AJAX request to check for an existing user once the first field has been filled in. I would recommend against it though, as it will be confusing for the user to find the form suddenly filling itself in - or not filling itself in if they make a mistake.

Most sites gat around this by having two user journeys - one for a new user where they have to fill in all fields, and another for returning users with a login system.

Thank you for the idea, I will try this. Else I would try ajax as you mentioned.

Sponsor our Newsletter | Privacy Policy | Terms of Service