phpde inputa yazı yazarken selection elemanı gibi birşey yaptım mesela veri tabanında abdullah ve abdurrahman var inputa abd yazdığımda bu iki isimde selectiondaki gibi geliyor benim istediğim gelen değerlerin üstüne tıkladığımda inputu aynı şekilde doldurması mesela abd yazdım abdullahın üstüne tıkladım inputu abdullah yapacak birde 2 tane input olacak ben yapınca göstermiyor
kodlarım şu şekilde
satis.php
satisaktar.php
kodlarım şu şekilde
satis.php
Kod:
<html>
<head>
<title>Search</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
*********
#show_up{
width: 200px;
height: 200px;
border: 1px solid #ddd;
display: none;
}
#show_up a{
border-bottom: 1px solid #ddd;
display: block;
padding: 5px;
}
</style>
</head>
<body>
<script>
$(********).ready(function(e){
$("#search").keyup(function(){
$("#show_up").show();
var text = $(this).val();
$.ajax({
type: 'GET',
url: 'satisaktar.php',
data: 'txt=' + text,
success: function(data){
$("#show_up").html(data);
}
});
})
});
</script>
<?php
$value=$_POST['value'];
?>
<input type="text" name="names" id="search" value="<?php echo $value ?>" />
<div id="show_up"></div>
</body>
</html>
Kod:
<!--#Ortala -->
</body>
</html>
<?php
// create a new function
function search($text){
try{
$baglan = $_SERVER["********_ROOT"] ."/access/dene.mdb";
if (!file_exists($baglan))
{
die("No database file.");
}
$db=new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$baglan; Uid=; Pwd=;");
$text = htmlspecialchars($text);
// prepare the mysql query to select the users
$get_name = $db->prepare("SELECT * FROM kisiler WHERE adi LIKE ?");
// execute the query
$get_name -> execute(array('%'.$text.'%'));
// show the users on the page
while($names = $get_name->fetch(PDO::FETCH_ASSOC)){
// show each user as a link
$namess=$names['adi'];
echo "
<input type='submit' class='gonder'>$namess</button>
";
}
}catch(PDOException $h) {
$hata=$h->getMessage();
echo "<b>HATA VAR :</b> ".$hata;
}}
// call the search function with the data sent from Ajax
search($_GET['txt']);
?>
<div id="sonuc"></div>