finpuss på søk
This commit is contained in:
parent
e6d76cd69c
commit
a684cb4841
@ -12,7 +12,12 @@
|
||||
font-size: 1.4em;
|
||||
padding: 1rem;
|
||||
border-radius: var(--bd-radius);
|
||||
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.profile-card h2{
|
||||
font-size: 2rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -29,7 +34,7 @@
|
||||
<h1>Søk opp løper</h1>
|
||||
<form action="/runner.php" method="GET" hx-boost="true" hx-target="#runner_info" hx-swap="show:none">
|
||||
<label>
|
||||
Navn eller startnummer
|
||||
Navn, startnummer eller klubb
|
||||
<input type="text" name="search" id="search">
|
||||
</label>
|
||||
<button type="submit">Søk</button>
|
||||
|
||||
@ -65,6 +65,9 @@ function search_for_runner($runner_list, $search_term) {
|
||||
elseif (str_contains($runner->id, $search_term)){
|
||||
array_push($filtered_runners, $runner);
|
||||
}
|
||||
elseif (str_contains(strtolower($runner->club), strtolower($search_term))){
|
||||
array_push($filtered_runners, $runner);
|
||||
}
|
||||
|
||||
}
|
||||
return $filtered_runners;
|
||||
|
||||
16
runner.php
16
runner.php
@ -31,12 +31,11 @@ if ($method == "GET") {
|
||||
$r = $filtered[0];
|
||||
$response .= "
|
||||
<h2> $r->name</h2>
|
||||
<p> Klubb: $r->club</p>
|
||||
<p> Løype: $r->course</p>
|
||||
<p> Epost: <a href=\"mailto:$r->email\">$r->email</a></p>
|
||||
<p> Mobilnummer: <a href=\"tel:$r->phone\">$r->phone</a></p>
|
||||
<p> Mobilnummer: <a href=\"tel:$r->phone\">$r->phone</a></p>
|
||||
<p> Student? $r->is_student</p>
|
||||
<p> <b>Klubb:</b> $r->club</p>
|
||||
<p> <b>Løype:</b> $r->course</p>
|
||||
<p> <b>Epost:</b> <a href=\"mailto:$r->email\">$r->email</a></p>
|
||||
<p> <b>Mobilnummer:</b> <a href=\"tel:$r->phone\">$r->phone</a></p>
|
||||
<p> <b>Student?</b> $r->is_student</p>
|
||||
";
|
||||
header("HX-Replace-Url: false");
|
||||
echo($response);
|
||||
@ -48,8 +47,11 @@ if ($method == "GET") {
|
||||
$runner = $filtered[$i];
|
||||
$response .= "<button class=\"default\" hx-get=\"/runner.php?search=$runner->id\" hx-target=\"#runner_info\" hx-swap=\"show:none\">$runner->id $runner->name</button>";
|
||||
header("HX-Replace-Url: false");
|
||||
echo($response);
|
||||
}
|
||||
echo($response);
|
||||
}
|
||||
else{
|
||||
echo("Ingen resultater...");
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user