如果表中的isset和echo,则语法错误

时间:2015-09-29 03:31:58

标签: php

请帮助诊断我在此处注明为**?></th>**的行的语法错误,但当然在我的实际代码中它是?></th>。我在本代码之前正确定义了所有变量,但未在此处显示。感谢您的帮助。

<table width="600" border="0" align="center">
  <tr>
    <th scope="row"><h1><?php
if (isset($_POST['dogTitle']))
{
            echo  $_POST['dogTitle'];

    }
?></h1></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['dogDescription']))
{
            echo  $_POST['dogDescription'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['vet']))
{
            echo  $_POST['vet'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"> <?php 
    if (isset($_POST['vetDescription']))
{
            echo  $_POST['vetDescription'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['apply_to_email']))
{
            echo  $_POST['apply_to_email'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['apply_to_url']))
{
            echo  $_POST['apply_to_url'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['vetCity']))
{
            echo  $_POST['vetCity'];
            ?></th>
  </tr>
  <tr>
    <th scope="row"><?php
    if (isset($_POST['vetState']))
{
            echo  $_POST['vetState'];
            ?></th>
  </tr>

 <tr>
    <th scope="row"><?php
    if (isset($_POST['vetZip']))
{
            echo  $_POST['vetZip'];
            ?></th>
  </tr>


  <tr>
    <th scope="row"><?php
    if (isset($_POST['FtPTCHrly']))
{
            echo  $_POST['FtPTCHrly'];
            **?></th>**
  </tr>

</table>

1 个答案:

答案 0 :(得分:3)

您忘记在此代码段后面填写If语句 所以,而不是这段代码。

<th scope="row"><?php
if (isset($_POST['dogDescription']))
{
        echo  $_POST['dogDescription'];
        ?></th>

用它替换它。

<th scope="row"><?php
if (isset($_POST['dogDescription']))
{
        echo  $_POST['dogDescription'];
 } // You missed this
 ?></th>

在你的代码中有很多地方这是错误所以,纠正它。