这与sql数据库结合使用。所以基本上从车辆数据库中选择vehicle_id
时,我希望它在表单中显示相应的vehicle_model
和vehicle_year
。
<select name="vehicle_id">
<?php foreach ($vehicles as $vehicle) : ?>
<option value="<?php echo $vehicle['vehicle_id']; ?>">
<?php echo $vehicle['vehicle_id']; ?>
</option>
<?php endforeach; ?>
</select><br>
<label>Vehicle Type:</label>
<input type="text" name="type"><br>
<label>Vehicle Model: </label>
<input type="text" name="model" value="<?php echo $vehicle['vehicle_model']; ?>"><br>
<label>Vehicle Year:</label>
<input type="text" name="year" value="<?php echo $$vehicle['vehicle_year']; ?>"><br>
<label> </label>
<input type="submit" value="Edit Vehicle"><br>