İstediğin örnek sanırım bu
<button id="toggleBtn">Aç / Kapa</button>
<div id="content">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
#content {
opacity: 0;
visibility: hidden;
position: relative;
top: 20px;
transition: 250ms all;
}
#content.active {
top: 0;
opacity: 1;
visibility: visible;
}
const toggleBtn = document.querySelector("#toggleBtn"),
content = document.querySelector("#content");
toggleBtn.addEventListener("click", () => {
content.classList.toggle("active");
});
Todolist uygulaması yap mesela
css ve javascript dosyalarını çekerken css/style.css değilde https://localhost/css/style.css gibi çek o zaman sorun kalmaz
Öncelikle merhaba bunu htaccess ile yapıcaksın
RewriteEngine On
RewriteRule ^([0-9a-zA-Z_]+)(/?)$ index.php?kul_adi=$1
Php'de yapman gereken ise
<?php
$kullanici_adi = $_GET["kul_adi"];
$row = $db->query("SELECT * FROM uyeler WHERE kullanici_adi = '" . $kullanici_adi . "' ")->fetch_assoc();
echo $row["sifre"];
?>
Daha fazla örnek için: https://www.phpr.org/php-htaccess-kullanimi/
İyi çalışmalar...
Öncelikle merhaba bunlar genellikle jquery ile yapılıyor jquery autocomlete paketiyle eğer sayfanda jquery yoksa https://www.w3schools.com/howto/howto_js_autocomplete.asp bu sayfada bir örnek var.
İyi çalışmalar...
Dostum bunu jquery kullanıyorsan jquery ajax methodu ile javascript kullanıyorsan fetch veya xmlhttprequest ile yapabilirsin. Diğer türlü işin uzun sürer.
Hemen bir örnek yapayım senin için:
<form id="formum">
Kaç Adet
25
<input type='number' value="25" id="deger" readonly />
</form>
<script>
const formum = document.querySelector("#formum");
formum.addEventListener("submit", e => {
e.preventDefault();
fetch("dosya_dizini", {
method: "post",
body: JSON.stringify("25")
})
.then(res => res.json())
.then(ans => {
console.log(ans);
});
});
</script>
Php dosyan:
$sayi = json_encode(file_get_contents("html_dosyasi"), true);
// işlem yapıldı
// ...
// ...
// ...
// ...
// ...
// ...
// ...
// işlem bitti
echo json_encode(/*İşlem sonucu*/);
İyi çalışmalar...
Öncelikle merhaba işlem javascript ile şu şekilde yapılabilir.
<?php
// islem.php
$arr = [
{
"baslik":"deneme"
},
{
"baslik":"deneme"
},
{
"baslik":"deneme"
},
{
"baslik":"deneme"
}
];
// Bu veriyi sen mysql'den çekeceksin ve en son
echo json_encode($arr); // Mysql'den gelen veriyi göndereceksin
?>
/*
* app.js
*/
// Javascript
fetch("islem.php", {
method: "GET"
})
.then(res => res.json())
.then(cevap => {
console.log(cevap);
});
// Eğer jquery ise Jquery islem dosyası aynı javascript ise bu olacak
$.ajax({
url: "islem.php",
method: "get",
dataType: "json",
success: function(cevap){
console.log(cevap);
}
});
Bu arada isteğin çok saçma bir siteyi ya php ile yaparsın yada php'yi sadece mysql bağlantısı için kullanırsın. Bu yüzden boşuna uğraşma ama eğer çok lazımsa bunlardan yola çık yazdığım kodu şuan test etme şansım olsaydı senin soruna cevap verebilirdim ama bunlardan yola çıkarak sorunun cevabını bulabilirsin.
İyi çalışmalar...
<input type="checkbox" id="checkbox">
<script>
let checkbox = document.querySelector("#checkbox");
checkbox.addEventListener("change", () => {
<?=setcookie("girisbilgileri", $gelenid, time() + (60*60*24));?>
});
</script>
En basit yol bu ama senin hatan form içine almaman. Eğer form içine alırsanda şu şekilde
<?php
if(isset($_POST['checkbox'])) {
setcookie("girisbilgileri", $gelenid, time() + (60*60*24));
}
?>
<form action="" method="post">
<input type="checkbox" name="checkbox" />
</form>
İyi çalışmalar...
Öncelikle merhaba ben udemy kurslarından öğrendim Sadık Turan'ın kursu modern javascript'i öğrenmeme çok yardımcı oldu sanada tavsiye ederim.
Udemy'de Sadık Turan Modern Javascript diye aratırsan bulabilirsin.
Öncelikle merhaba kullanımı şu şekilde dener misin.
// Javascript
document.querySelector("#menu").addEventListener("click", () => {
document.querySelector("body").style.opacity = "0.3";
});
// Jquery
$("#menu").on("click", function(){
$("body").css("opacity", "0.3");
});
İyi çalışmalar...