Home >Backend Development >PHP Tutorial >How to control the hiding and display of html elements in php
1. I use PHP to determine whether a file exists. If it exists, I will open it directly. If it does not exist, an HTML td element will pop up (content: the file you are looking for does not exist, please re-enter it), and then hide the td element when inputting. . Please tell me how to control this html element? Maybe my approach is wrong. If there are other ways, please let me know
2. Code:
<code>`<?php if($_POST){ $name=$_POST['text1'].'-'.$_POST['text2'].$_POST['set3']; // $url="../PDF/".$name.'.pdf'; if(file_exists($url)){ echo "<script>window.open('$url','_blank');</script>"; }else{ //echo "<script>alert('文件名错误!请检查后重新输入!');window.history.back(-1); </script>";//错误弹出提示框 // 注意:我想在此处控制td元素的显示 } } </code>
?>`