php - Is there a way to display database values based on user input values using HTML form? If yes, how can I do that? -


so trying call value based on user input. have written code for form need call value server based on user type on form.

this have written until now:

@$conn = new mysqli($host, $user, $pass, $db_name); $resault = $conn->query("select * field_data_field_paint_efficeincy_"); $rows=$resault->fetch_all(mysqli_assoc); echo '<pre>',print_r($rows),'</pre>';foreach($rows $row){ echo $row['field_paint_efficeincy__value'], '<br>'; } ?> <form action="" method="post">    variable: <input type="number" name="p" value="0" /> <br/> 

something this:

<?php if(isset($_get["p"])) {    $conn = new mysqli($host, $user, $pass, $db_name);    $resault = $conn->query("select * field_data_field_paint_efficeincy_ field_paint_efficeincy__value = '" . $_get["p"] . "'");    //assuming field_paint_efficeincy__value column should match input value     if ($resault->num_rows > 0) {         while($row = $resault->fetch_assoc()) {               echo $row['field_paint_efficeincy__value'] . "<br />";         }    }      $conn->close(); } ?>  <form action="<?php echo $_server['php_self']?>" method="get">    variable: <input type="number" name="p" value="0" /> <br/>    <input type="submit" value="submit" name="submitbutton" /> </form> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -