没有输入时隐藏c_box

时间:2013-11-02 08:55:18

标签: php html arrays video hide

如果没有http://bloxhotel.nl/video?watch=YxIiPLVR6NA

等输入,我想要

不会弹出一个框

    <?php
ob_start();
include 'includes/inc.bootstrap.php';
$page = Array('title' => ((isset($user)) ? $user->username : ''), 'onload' =>      ((isset($_GET['utm_source']) && $_GET['utm_source'] == 'welcome') ?   'Pixel.View.OpenUrlOverlay(\'/pixlett/Video.php\');' : ''), 'tab' => Array('me', 'home'),   'access' => Array(true, false));
include 'content/header.php';
include 'content/menu.php';
?>
<center>
<div class="c_box" style="overflow: hidden; width: 58%; height: 10%;">
<div class="heading blue">Ga naar Video</div>
<tr style="padding: 4px;">
<html>
<body>

<form action="welcome_get.php" method="get">
Youtube Link: <input type="text" name="link"><br>
<input type="submit">
</form>

</body>
</html>

</div>
<center>
<div class="c_box" style="overflow: hidden; width: 58%; height: 10%;">
            <div class="heading blue">Video</div>

<?php
$watch = $_GET['watch'];


$embed = '<embed src="http://bloxhotel.nl/Player7.swf" flashVars="video_id='.$watch.'"      style="width: 100%; height: 57%;" allowScriptAccess="always" autoplay="false" allowFullscreen="true" type="application/x-shockwave-flash" wmode="transparent"         id="player_demo"></embed></object>';

echo $embed;
?>
</div>
</center>

<?php
$watch = $_GET['watch'];


$embed = '<embed src="http://bloxhotel.nl/Player7.swf" flashVars="video_id='.$watch.'"    style="width: 100%; height: 57%;" allowScriptAccess="always" autoplay="false"   allowFullscreen="true" type="application/x-shockwave-flash" wmode="transparent"   id="player_demo"></embed></object>';

echo $embed;
?>

不需要出现 那么,如果视频中没有输入?watch =该框需要保持隐藏

有人可以提供帮助

2 个答案:

答案 0 :(得分:0)

只需检查

if(!empty($_GET['watch']) {echo $some_other_text; //or echo '';} else {echo $embed}

这样,它会检查手表是否空的天气。

您还可以检查是否添加了?watch,如下所示:

if(!isset($_GET['watch'])||!empty($_GET['watch'])) {//do not echo your box}

else {//echo your box} 

答案 1 :(得分:0)

你期待这样的事吗?

 <?php 
  $watch = trim($_GET['watch']);
    if($watch!=""){
 ?>

   <div class="c_box" style="overflow: hidden; width: 58%; height: 10%;">
       <div class="heading blue">Video</div>

        <?php
        $embed = '<embed src="http://bloxhotel.nl/Player7.swf" flashVars="video_id='.$watch.'"      style="width: 100%; height: 57%;" allowScriptAccess="always" autoplay="false" allowFullscreen="true" type="application/x-shockwave-flash" wmode="transparent"         id="player_demo"></embed></object>';

        echo $embed;
        ?>
    </div>

<?php } ?>