Solution 1 :

First of all, your inputs ,buttons,select,radio buttons..etc must be inside a form tag

<form method="post/get" action="file.php">

Secondly, all your inputs need to have a name to retrieve their values. For exemple :

<input type="text" name="firstname">

And finally, it’s better to giver every option in select tag a value:

 <select class="form-control" name="pet">
     <option value="cat">Cat</option>
     <option value="dog">Dog</option>
     <option value="others">Others</option>  
 </select>

Changed work :

<form method="post" action"file.php">
    <div class="form-group">
    <span class="form-label">Where do you work? </span>
    <input class="form-control" type="text" placeholder="Please enter your city" name="city">
    </div>
    <!-- date picker -->

    <div class="row">
    <div class="col-sm-6">
    <div class="form-group">
    <span class="form-label">Please take care of my pet on</span>
    <input class="form-control" type="date", id="pickup" name="pickup" required>
    </div>
    </div>

    </div>

    <div class="row">
    <div class="col-sm-6">
    <div class="form-group">
    <span class="form-label">Pet?</span>
    <select class="form-control" name="pet">
    <option value="cat">Cat</option>
    <option value="dog">Dog</option>
    <option value="others">Others</option>
    </select>
    <span class="select-arrow"></span>
    </div>
    </div>

    </div>
    <div class="form-btn">
    <button class="submit-btn">Check availability</button>
    </div>
</form>

In your file.php you need to retrieve data with $_POST :

<?php
     $city=$_POST['city'];
     $date=$_POST['pickup']; 
     $pet=$_POST['pet'];
?>

Solution 2 :

First of all, you have to wrap all this code in <form></form> tag:

<form method="post" action="path_to_your_php_handler">
    <div class="form-group">
    <!-- other stuff -->
        <button type="submit" class="submit-btn">Check availability</button>
    </div>

</form>

Also, all your inputs should have an unique attribute name, like <input class="form-control" type="date", id="pickup" name="date" required>
Than, in your php file, you can find your input values in array $_POST, like $_POST['date'] from the input with name ‘date’.

Problem :

I am using an html with div tag to do a booking system asking user input for city, date, and pet type then check the criteria from users to the SQL database, I know how to deal with just html but I am totally lost when dealing with html div tags.
Can anyone show me how to take the user inputs (city, date, and pet type) using php in the right place so i can pass it to the database to check

booking input

<div class="form-group">
<span class="form-label">Where do you work? </span>
<input class="form-control" type="text" placeholder="Please enter your city">
</div>
<!-- date picker -->

<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Please take care of my pet on</span>
<input class="form-control" type="date", id="pickup" required>
</div>
</div>

</div>

<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Pet?</span>
<select class="form-control">
<option>Cat</option>
<option>Dog</option>
<option>Others</option>
</select>
<span class="select-arrow"></span>
</div>
</div>

</div>
<div class="form-btn">
<button class="submit-btn">Check availability</button>
</div>

Comments

Comment posted by El_Vanja

Is this content inside a

By