使用php将所选字段用作源路径/目录来显示图像

问题描述 投票:-1回答:1

如何根据3个选择字段(省,年,月)显示图像文件。地点和年份是文件夹,月份是图像文件。提交后,图像应显示在选择框下方的框中。

有人可以帮忙吗?

先感谢您!

here's how it looks

javascript php html css
1个回答
0
投票

你的意思是这样的吗?

<?php
if(isset($_POST['submitBtn'])) {

    $place = $_POST['province'] . '/';
    $year = $_POST['year'] . '/';
    $month = $_POST['month'] . '.jpg'; // or whatever your format is

    echo '<img src="' . $place . $year . $month . '">';

}
?>
© www.soinside.com 2019 - 2024. All rights reserved.