Autyo submit, get plus court

This commit is contained in:
Fred Tempez 2023-07-13 21:04:57 +02:00
parent 4aebec2a32
commit 58ee2a9ed0
3 changed files with 13 additions and 9 deletions

View File

@ -30,7 +30,7 @@ function getCalendrier()
$url = $link->getAttribute('href');
$calendrier[] = array(
'node' => $node,
'url' => 'https://www.sabradou.com/' . $url
'url' => $url,
);
}
return ($calendrier);
@ -38,7 +38,7 @@ function getCalendrier()
function getCities($html)
{
// Création d'un objet DOMDocument
$html = file_get_contents($html);
$html = file_get_contents('https://www.sabradou.com/' . $html);
$dom = new DOMDocument();
libxml_use_internal_errors(true); // Ignore les erreurs de parsing HTML
$dom->loadHTML($html);

1
index.js Normal file
View File

@ -0,0 +1 @@

View File

@ -5,23 +5,26 @@
<head>
<title>Carte Sabradou</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="index.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<body
<div class="header">
<h1>GÉOLOCALISATION DES BROCANTES RÉFÉRENCÉES</h1>
<h2>SUR LE SITE <a href="https://www.sabradou.com/" target="_blank">SABRADOU.COM</a></h2>
<form class="form" action="index.php" method="GET">
<label for="calendrier-list">Brocantes du :</label>
<select name="calendrier" id="calendrier-list">
<form if="form" action="index.php" method="GET">
<label for="calendrier">Brocantes du :</label>
<select name="calendrier"onchange="this.form.submit()" id="calendrier-list">
<?php $calendrier = getCalendrier(); ?>
<?php foreach ($calendrier as $item): ?>
<option value="<?php echo $item['url']; ?>"><?php echo $item['node']; ?></option>
<?php endforeach; ?>
<?php $selected = isset($_GET['calendrier']) && $_GET['calendrier'] === $item['url'] ? 'selected' : ''; ?>
<option value="<?php echo $item['url']; ?>" <?php echo $selected; ?>><?php echo $item['node']; ?></option>
<?php endforeach; ?>
</select>
<input type="submit" value="Localiser sur une carte">
<!--<input type="submit"value="Localiser sur une carte">-->
</form>
</div>
<div class="container">