2

init内でHTMLコードを使用しているphpコードでdivタグを非表示にしたいのですが、1つの条件がfalseの場合、その特定のdivは表示されません。これが私のコードです。このコードでは、非表示にしたいdiv id="work_exp"

<?php
$fname=$_POST['fname'];
$obj=$_POST['obj'];
$xdate=$_POST['xdate'];
$xmonth=$_POST['xmonth'];
$xyear=$_POST['xyear'];
$addr=$_POST['addr'];
$city=$_POST['city'];
$pin=$_POST['pin'];
$country=$_POST['country'];
$mob=$_POST['mob'];
$email=$_POST['email'];
$gender=$_POST['gender'];
$ms=$_POST['ms'];
$institute1=$_POST['institute1'];
$qual1=$_POST['qual1'];
$grade1=$_POST['grade1'];
$year1=$_POST['year1'];

$institute2=$_POST['institute2'];
$qual2=$_POST['qual2'];
$grade2=$_POST['grade2'];
$year2=$_POST['year2'];

$institute3=$_POST['institute3'];
$qual3=$_POST['qual3'];
$grade3=$_POST['grade3'];
$year3=$_POST['year3'];

$institute4=$_POST['institute4'];
$qual4=$_POST['qual4'];
$grade4=$_POST['grade4'];
$year4=$_POST['year4'];

$title=$_POST['title'];
$tech=$_POST['tech'];
$domain=$_POST['domain'];
$desc=$_POST['desc'];

$cert=$_POST['cert'];
$intern=$_POST['intern'];

$otrp=$_POST['otrp'];
$csk=$_POST['csk'];
$rwork=$_POST['rwork'];
$salary=$_POST['salary'];

$refname=$_POST['refname'];
$refjob=$_POST['refjob'];
$refadd=$_POST['refadd'];
$refphone=$_POST['refphone'];
$refemail=$_POST['refemail'];
$reflen=$_POST['reflen'];

session_start();

$_SESSION['ename1']=$_POST['ename1'];

$_SESSION['industry1']=$_POST['industry1'];
$_SESSION['position1']=$_POST['position1'];
$_SESSION['responsibility1']=$_POST['responsibility1'];
$_SESSION['from1']=$_POST['from1'];
$_SESSION['to1']=$_POST['to1'];
$_SESSION['ex1']=$_POST['ex1'];

$_SESSION['ename2']=$_POST['ename2'];
$_SESSION['industry2']=$_POST['industry2'];
$_SESSION['position2']=$_POST['position2'];
$_SESSION['responsibility2']=$_POST['responsibility2'];
$_SESSION['from2']=$_POST['from2'];
$_SESSION['to2']=$_POST['to2'];
$_SESSION['ex2']=$_POST['ex2'];


echo "<html>";
echo "<head>";

echo "<title>RESUME</title>";
echo "<link rel='stylesheet' type='text/css' href='res.css'>";
echo "</head>";
echo "<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
</script>";
echo "<body>";
echo "<center><font size='+3' color='#000000' face='Arial, Helvetica, sans-serif'>RESUME</font></center><br /><br />";
echo "<div id='container'>";
echo "<div id='pers_detail'>";
echo "<h3>".$fname."</h3>";
echo "<h4>ADDRESS</h4>";
echo "<p>".$addr."<br />";
echo $city." - ".$pin."<br />";
echo $country."<br />";
echo "</p>";
echo "</div>";
echo "<br />";
echo "<br />";
echo "<div id='con'>";
echo "<h4>CONTACT</h4>";
echo "<p>";
echo "Mobile:".$mob."<br />";
echo "E-Mail:".$email."<br />";
echo "</p>";
echo "</div>";
echo "<div id='obj'>";
echo "<table width='56%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OBJECTIVE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td><p align='justify'>".$obj."</p></td>";
echo "</tr>";
echo "</table></div>";
echo "<div id='academy'>";
echo "<table width='100%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   ACADEMIC DETAILS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td><p align='center'><b>INSTITUTION</b></p></td>";
echo "<td><p align='center'><b>QUALIFICATION</b></p></td>";
echo "<td><p align='center'><b>CGPA/GRADE</b></p></td>";
echo "<td><p align='center'><b>YEAR</b></p></td>";
echo "</tr>";
if(!$institute1=="" || $institute1!=="NIL")
{
echo "<tr>";
echo "<td><p align='center'>".$institute1."</p></td>";
echo "<td><p align='center'>".$qual1."</p></td>";
echo "<td><p align='center'>".$grade1."</p></td>";
echo  "<td><p align='center'>".$year1."</p></td>";
echo "</tr>";
echo "<tr>";
}
if(!$institute2==""|| $institute2!=="NIL")
{
echo "<td><p align='center'>".$institute2."</p></td>";
echo "<td><p align='center'>".$qual2."</p></td>";
echo "<td><p align='center'>".$grade2."</p></td>";
echo  "<td><p align='center'>".$year2."</p></td>";
echo "</tr>";
}
if(!$institute3==""|| $institute3!=="NIL")
{
echo "<td><p align='center'>".$institute3."</p></td>";
echo "<td><p align='center'>".$qual3."</p></td>";
echo "<td><p align='center'>".$grade3."</p></td>";
echo  "<td><p align='center'>".$year3."</p></td>";
echo "</tr>";
}
if(!$institute4==""|| $institute4!=="NIL")
{
echo "<td><p align='center'>".$institute4."</p></td>";
echo "<td><p align='center'>".$qual4."</p></td>";
echo "<td><p align='center'>".$grade4."</p></td>";
echo  "<td><p align='center'>".$year4."</p></td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
echo "<div id='aca_det'>";
echo "<table width='100%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;  ACADEMIC PROJECT DETAILS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td width><b>TITLE</b></td><td>".$title."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width><b>TECHNOLOGY USED</b></td><td>".$tech."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=30%><b>DOMAIN</b></td><td>".$domain."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width><b>DESCRIPTION</b></td><td><p align='justify'>".$desc."</p></td>";
echo "</tr>";
echo "</table>";
echo "</div>";
if($cert !="NIL" || $intern !="NIL")
{
echo "<div id='otherinfo'>";
echo "<table width='100%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OTHER INFORMATIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
if($cert !="NIL")
{
echo "<tr>";
echo "<td width><b>CERTIFICATION</b></td><td>".$cert."</td></tr>";
echo "<tr>";
}
if($intern !="NIL")
{
echo "<td width=30%><b>INTERNSHIP</b></td>";
echo "<td><p align='justify'>".$intern."</p></td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
}
if($_SESSION['ename1']!="" && $_SESSION['ename2']!="")
{
$new='<script> 
$(document).ready(function(){

    $("#work_exp").slideDown("slow");

});
</script>
 <div id="work_exp">

 <table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">

 <tr>
 <td colspan="4"align="left"><font style="background-color:#F3F5EF" size="+1" color="#000000" face="Arial, Helvetica, sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WORK EXPERIANCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
 </tr>
 </table>

 <table width="99%" border="0" cellspacing="1" cellpadding="2" align="center">
 <tr>
 <td colspan="4" align="left"><font size="+1" color="#000000" face="Arial, Helvetica, sans-serif">&nbsp;EMPLOYER ONE DETAILS</font></td>
 </tr>
  <tr>
 <td width="210"><b>Employer</b></td> <td width="327"></td>
 </tr>

 <tr>
 <td><b>Industry</b></td><td></td>
 </tr>
 <tr>
 <td><b>Position</b></td><td></td>
 </tr>

 <tr>
 <td><b>Responsibilities</b></td><td></td>
 </tr>

 <tr>
 <td><b>From</b></td><td></td>

 <td width="18"><b>To</b></td><td width="249"></td>
 </tr>

 <tr>
 <td><b>Salary</b></td><td></td>
 </tr>
 </table>

 <table width="99%" border="0" cellspacing="1" cellpadding="2" align="center">
 <tr>
 <td colspan="4" align="left"><font size="+1" color="#000000" face="Arial, Helvetica, sans-serif">&nbsp;EMPLOYER TWO DETAILS</font></td>
 </tr>
 <tr>
 <td width="210"><b>Employer</b></td> <td width="327"></td>
 </tr>
 <tr>
 <td><b>Industry</b></td><td></td>
 </tr>
 <tr>
 <td><b>Position</b></td><td></td>
 </tr>
 <tr>
 <td><b>Responsibilities</b></td><td></td>
 </tr>  
 <tr>
 <td><b>From</b></td><td></td>
 <td width="28"><b>To</b></td><td width="249"></td>
 </tr>
 <tr>
 <td><b>Salary</b></td><td></td>
 </tr>
 </table>
 </div>';
}
echo $new;
echo "<div id='misc'>";
echo "<table width='99%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MISCELLANEOUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%'><b>FULL NAME</b></td>";
echo "<td>".$fname."</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%'><b>DATE OF BIRTH</b></td>";
echo "<td>".$xdate."/".$xmonth."/".$xyear."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>GENDER</b></td><td>".$gender."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>MARITAL STATUS</b></td><td width='75%'>".$ms."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>OWN TRANSPORT:</b></td>";
echo "<td>".$otrp."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>COMMUNICATION SKILLS:</b></td>";
echo "<td>".$csk."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>EXPECTED SALARY:</b></td>";
echo "<td>".$salary."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>READY TO WORK:</b></td>";
echo "<td>".$rwork."</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<div id='ref'>";
echo "<table width='99%' border='0' cellspacing='1' cellpadding='2' align='center'>";

echo "<tr>";
echo "<td colspan='4' align='left'><font style='background-color:#F3F5EF' size='+1' color='#000000' face='Arial, Helvetica, sans-serif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REFERENCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>NAME</b></td>";
echo "<td>".$refname."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>OCCUPATION</b></td>";
echo "<td>".$refjob."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>ADDRESS</b></td>";
echo "<td><p align='justify'>".$refadd."</p></td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>CONTACT NUMBER</b></td>";
echo "<td>".$refphone."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>E-MAIL</b></td>";
echo "<td>".$refemail."</td>";
echo "</tr>";
echo "<tr>";
echo "<td><b>RELATIONSHIP</b></td>";
echo "<td>".$reflen."</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "</div>";
echo "</body>";
echo "</html>";
?>
4

4 に答える 4

5

まず第一に、PHP を使用して HTML をあまりエコーしないでください。次のようにする必要があります。

<?php
   //Write your PHP here
?>
HTML HERE
<?php
   //PHP here again
?>

条件については、次のように簡単に書くことができます

<?php
  if(condition) {
?>
   Content to be shown
<?php
  }
?>

一方else、条件が満たされない場合は、ステートメントを使用してコンテンツを表示することもできます。

于 2013-04-23T11:28:07.760 に答える
3

div を表示するエコーの前に「if」を使用するだけです。

if(...Your_condition...)
{
  echo "<div id='work_exp'> ... </div>";
}

PS、多くのエコーを使用してページを構築しないでください。

于 2013-04-23T11:26:17.097 に答える
1

サーバー側で非表示にする場合は、次のようにします。

<?php
    // ...
    if ($showThisDiv)
    {
        ?>
        <div>This is a div</div>
        <?php
    }
    // ...
?>

このようにしてエコーを回避するため、多くの HTML を引用符で囲む必要はありません。

于 2013-04-23T11:28:21.837 に答える