php - 如何根据选择的其他选择选项更改选择选项?
问题描述
我需要获取选择时生成的 pdf 路径文件:
1- Type document
2- Date
3- Unity
Type: 1 - 2 - 3
Unity: A - B - C
Date: yyyy/m/d
这是我应该管理信息的代码,所有数据都使用 cookie 存储。
这是 PHP 文件 - file.php:
<select id="diretorioArquivo" name="diretorioArquivo" class="" onChange=""abrir.location = options[selectedIndex].value">
<option class="dropdown-item" selected disabled>Selecione um arquivo...</arquivo>
<?php
$data_unidade = $_COOKIE['data_unidade'];
$tipo_arquivo = $_COOKIE['tipo_arquivo'];
$id_unidade = $_COOKEI['id_unidades'];
$urlPdf = 'http://localhost'.$data_unidade.'&tipo_arquivo='.$tipo_arquivo.&unidade_id='.$id_unidade;
$recolhePdf = file_get`enter code here`_contents($urlpdf);
$resultPdf = json_decode($recolhePdf);
foreach($resultPdf as $pdf) {
?>
<option id="<?php echo $pdf->id. ?>" value="localhost/arquivos/<?php echo $pdf->caminho; ?>"
class=""<?php echo $pdf->caminho; ?></option>
<?php
}
?>
</select>
<!-- USING JQUERY -->
<script>
$('#diretorioArquivo').on('change', function() {
var src=$(this).find('option:selected').val();
$('#abrir').attr('src', src);
});
</script>
解决方案
推荐阅读
- angular - 打开相同 Ngx-Bootstrap 模态的多板
- magento2 - 如何在服务器的子目录中部署 magento pwastudio?
- macos - macOS 终端,User 文件夹的目录
- flutter - 在 dart 中读取 UTF-16 LE 文件
- java - Android Google Map如何检查用户是否在标记矩形区域
- android - 如何在 android 中使用 style.xml 设置填充和文本类型面
- ios - 为什么我不能在@IBAction func 之外调用函数 StartTime?
- java - 如何在 Prometheus 中持续轮询 JSON 数据?
- python - 如何在熊猫中执行条件分组计算并前向填充零值
- database - 在 Docker 创建 MongoDB 上创建用户