php - How to allow only pass predefined values from HTML form? -


i have html form select input , predefined values. actually, job noticed in chrome if change in code, via built-in addon "search elements", value 100000005555555, accepted should accept predefined values function.

a validation select input doesn't exist, because don't know how realize that.

the html code:

<select id="category1" name="category1" class="levels"> <option value="">category</option> <?php $listings->listcategoriesname();?> </select> 

the listcategoriesname function:

class listings{     /* * categories mysql */     public function listcategoriesname(){         global $pdo;         $result = $pdo->query("select * class_categories");         $row = $result->fetchall();          foreach($row $row) {echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';}}     } } 

the function's output is:

<option value="107">beauty & wellness</option> <option value="108">category 2</option> 

and on....

does have idea?

a validation select input doesn't exist, because don't know how realize that.

you ask requires validation. isn't hard implement. match category1 value post array of category names database in_array() : http://php.net/manual/en/function.in-array.php


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -