我的整个HTML页面都在PHP文件中。 (的index.php) 这就是我的index.php的样子:
some HTML code...
Kiválasztott hét: <select id="hetvalaszto" onchange="changeWeek()">
<?php
$connection = mysqli_connect("localhost:8889","root","root","imreigye_wp") or die("Error " . mysqli_error($connection));
mysqli_set_charset($connection, 'utf8mb4');
$sql = "select * from rendelesiidok order by het";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
$prevhet = "";
$hszarr = array();
while($row =mysqli_fetch_assoc($result))
{
if ($row['Het'] == $prevhet) {} else if ($row['Het'] == "999")
echo "<option value=" . $row['Het'] . ">Alap hét</option>";
else
echo "<option value=" . $row['Het'] . ">" . $row['Het'] . ". hét</option>";
$prevhet = $row['Het'];
}
mysqli_close($connection);
?>
</select>
...some more HTML code
PHP代码填充下拉列表。我想要做的是:我想在页面加载后使用javascript或jquery重新填充下拉列表。为此,我需要再次运行php代码。