开发者

unexpected T_VARIABLE error whilst setting up form validation

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" val开发者_运维问答ign="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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜