检查php中是否已存在ID,如果不执行某项操作

I have a form with an id AdvanceForm. I want to check if the form exists on the HTML and if not show it. I know I can do this with jQuery but I want to check before I load the form onto my HTML because otherwise repeating form clash in mycase. Is there a way to check?

What Im trying to do

Maybe I'm using a stupid way around. What I want to do is, Im making a site responsive and it has a search form with the above ID. When viewd on a computer I want to leave the standard form, but when viewed on a mobile, I want to hide the standard and load my modified, mobile friendly form. I used Mobile Detect script. But its not the best solution. Thanks in advance. Any thoughts welcome

Heres what I tried

<?php require_once TEMPLATEPATH . 'Mobile_Detect.php'; 
$detect = new Mobile_Detect; ?>

    <?php if ($detect->isMobile() || $detect->isTablet() && !$detect->isiPad()):?>
    <?php advanceForm(); ?>
    <?php endif; ?>

The reason i want to hide on iPad is because the website is responsive only upto 800px, anything over shows the desktop version with the Standard form and I want to hide the Modified form on every device over 800px