html - Send ID instead Name in PHP and MYSQL -
problem:
i want send id database table instead of name. want display name in field instead of id. work's while send through combo box. don,t know how work search field. php code given below:
<font> <b>name: </b></font> <?php include("database/db.php"); if($link === false){ die("error: not connect. " . mysqli_connect_error()); } $sql = "select * table"; $result = $link->query($sql); ?> <select name="id"> <?php if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $ad_id = $row["id"]; $name= $row['name']; ?> <option value="<?php echo $ad_id; ?>"><?php echo $name; ?></option> <?php } } else { echo "0 results"; } // close connection mysqli_close($link); ?> </select>
as per comment can use auto complete text box in php mysql using ajax call fulfill requirement search name.
there link available in web can search , implement have changes id contact name
Comments
Post a Comment