假设我有一个带有邮政编码字段 ( text
) 和学校字段 ( selection
) 的表单,目前我能够使用数据库中的学校名称填充选择列表,但我希望与所选学校链接的邮政编码自动填充:
<?php
$conn = mysqli_connect("localhost", "twa312", "dam6av9a");
mysqli_select_db(twa312, $conn)
or die ('Database not found ' . mysqli_error() );
$options = '<option value="0"></option>';
$sql = "SELECT school_info.name AS name, local_schools.postcodeID AS postcode FROM school_info INNER JOIN local_schools ON local_schools.schoolID = school_info.schoolID";
$rs = mysqli_query($sql, $conn)
or die ('Problem with query' . mysqli_error());