Home  >  Article  >  Backend Development  >  How to control the hiding and display of html elements in php

How to control the hiding and display of html elements in php

WBOY
WBOYOriginal
2016-10-17 09:12:192188browse

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>

?>`

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn