First functions

This commit is contained in:
genuineparts 2025-07-05 21:24:53 +02:00
parent c89f3a4171
commit 33d32256a3
7 changed files with 127 additions and 1 deletions

View file

@ -14,6 +14,28 @@ if (!isset($_SESSION['account_loggedin'])) {
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>Home</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script>
function suggest(val){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('suggest_container').innerHTML=this.responseText;
}
};
xhttp.open("GET", ("suggest.php?type=station&name="+ encodeURI(val)), true);
xhttp.send();
}
function suggestStation(val){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('suggest_stations').innerHTML=this.responseText;
}
};
xhttp.open("GET", ("suggest.php?type=stationName&name="+ encodeURI(val)), true);
xhttp.send();
}
</script>
</head>
<body>
@ -48,10 +70,28 @@ if (!isset($_SESSION['account_loggedin'])) {
<div class="block">
<p>This is the home page. You are logged in!</p>
<form>
Bildschirm 2:<br>
Name: <input type="text" name="title">
Abfahrtszeit: <input type="text" name="time">
Zug (z.b. REX 3): <input type="text" name="train">
Station: <input type="text" name="station" list="listit" onkeyup="suggest(this.value)" id="station">
Endstation des Zugs: <input type="text" name="endstation" list="liststations" onkeyup="suggestStation(this.value)" id="endstation">
<div id="suggest_container" style="display:inline-block;">
<datalist id="listit">
<option ></option>
</datalist>
</div>
<div id="suggest_stations" style="display:inline-block;">
<datalist id="liststations">
<option ></option>
</datalist>
</div>
</form>
</div>
</div>
</body>
</html>
</html>