dongziduo9762 2011-05-03 04:11
浏览 57
已采纳

设置表单验证时出现意外的T_VARIABLE错误

i am trying to set up form validation but keep receiving Parse error: syntax error, unexpected T_VARIABLE on line 146 whenever i try to load the page.

lines 133-153 of my code are

<?php
    if (array_key_exists('submit',$_POST)){
    //set up layout
    echo '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="height: 140px;">
          <tr>
            <td width="60%" valign="middle"><a href="index.php"><img src="resources/img/kite.png" alt="" width="250" height="101" border="0"/></a></td>
            <td width="40%" align="left" valign="middle"></td>
                  </tr>
                </table>
              </form></td>
          </tr>
        </table>';
         // Fields that are on form
        $expected = array('name', 'email', 'comments');
        // Set required fields
        $required = array('name', 'comments');
        // Initialize array for errors
        $errors = array();
    exit;
    }
    ?>

many thanks in advance!

  • 写回答

1条回答 默认 最新

  • douwang9650 2011-05-03 04:34
    关注

    I get this kind of error sometimes when i copy and paste code from an outside source (websource , or microsoft word). Depending on the editor you use, try to see if you have any option to display invisible characters, such as spaces, tabs, and new lines.

    You probably have a foreign character that is not visible.

    If you don't have such an editor, simply erase the white space in the line causing the problem and add your own white space using a the space bar or tab.

    try that and let us know.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记