Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member KillaTeddyX's Avatar
    Join Date
    Dec 2006
    Posts
    81
    Member #
    14455
    Hi guys I need your help I am working through making a form that on one side registered users can login and on the other side unregistered users can sign up I have hit a problem as I am getting this message.
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}' in C:\xampp\htdocs\Double_form.inc on line 99
    Here is the code
    PHP Code:
    <?php
    /* File: double_form.inc
     Desc: Contains the code for a web page that displays two html forms, side by side in atable.
     */
     
    include("functions.inc");
     
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><?php echo $page['title'?></title>
    </head>

    <body>
    <h1><?php echo $page['top'?></h1>
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <!-- Form 1 -->
    <tr>
    <td width="33%" valign="top">
    <?php echo $elements_1['top']?>
    <!-- Left handside form -->
    <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
    <table border="0">
    <?php 
    if (isset($GLOBALS['message_1']))
    {
    echo 
    "<tr>
    <td colspan='2'>
    {$GLOBALS['message_1']}</td>
    </tr>"
    ;
    }
    foreach(
    $fields_1 as $field => $value)
    {
    if(
    erreg("pass",$field))
    $type "password";
    else
    $type "text";
    echo 
    "<tr>
    <td>
    $value</td>
    <td><input type='
    $type' name='$field' value='".@$$field."' size='{$length_1[$field]}' msxsze ='{$length_1[$feld]}' />
    </td>
    </tr>"
    ;
    }
    ?>
    <tr>
     <td><input type="submit" name="button" value="<?php echo $elements_1['submit']?>" />
     </td>
     </tr>
     </table>
     </form>
     </td>
     
     <!-- Column to seperate the tables -->
     <td style="background-color:#999999;">&nbsp;</td>
     
     <!-- Form 2 -->
     <td width="67%">
     <?php echo $elements_2['top']?>
     <!-- Right hand side form -->
     <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
     <table border="0" width="100%">
     <?php 
     
    if (isset($GLOBALS['message_2']))
     {
     echo
    "<tr>
     <td>
    {$GLOBALS['message_2']}</td>
     </tr>"
    ;
     }
     foreach(
    $fields_2 as $field => $value)
     {
     if(
    $field == "state")
     {
     echo 
    "<tr>
     <td>State</td>
     <td><select name='state'>"
    ;
     
    $selectName=getStateCode();
     
    $stateCode=getStateCode();
     for (
    $n=1;$n<=50;$n++)
     {
     
    $state=$stateName[$n];
     
    $scode=$stateCode[$n];
     echo 
    "<option value'$scode'";
     if (
    $scode == @$_POST['state'])
     echo 
    " selected";
     echo 
    ">$state\n";
     }
     echo 
    "</select>";
     }
     else
     {
     if(
    ereg("pass",$field))
     
    $type "password";
     else
     
    $type "text";
     echo 
    "<tr>
     <td>
    $value</td>
     <td><input type='
    $type' name='$field'
     value=\""
    .@$$field."\"
     size='
    {$length_2[$field]'
     maxsize='
    {$length_2[$field]}'>/*This is line 99*/
     </td>
     </tr>";
     }
     }
     ?>
     <tr>
     <td colspan="2">
     <input type="submit" name="Button" value="<?php echo $elements_2['
    submit']?>" />
     </td>
     </tr>
     </table>
     </form>
     </td>
     </tr>
     </table>
     <div><?php echo $page['
    bottom']?></div>
     
    </body>
    </html>
    Line 99
    PHP Code:
    maxsize='{$length_2[$field]}'
    Edit: Dont need help debugged it myself lol

  2.  

  3. #2
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    PHP Code:
    $type "text";
     echo 
    "<tr>
     <td>
    $value</td>
     <td><input type='
    $type' name='$field'
      value=\""
    .@$$field."\"
     size='
    {$length_2[$field]' // ERROR HERE
     maxsize='
    {$length_2[$field]}'>/*This is line 99*/
     </td>
     </tr>";
     } 
    You missed the closing curly brace where I've poorly tried to highlight it:

    PHP Code:
      size='{$length_2[$field]' 
    I also noticed you mixing up your speech marks and single quotes, it may be better to keep it consistent, as you've used single quotes in most of the string, but then decide to escape the speech marks to insert another variable. It's fairly confusing.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:59 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com