Results 1 to 4 of 4

Thread: Parse error: parse error, unexpected T_INC in ..../8p1.php on line 71

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2013
    Posts
    2

    Parse error: parse error, unexpected T_INC in ..../8p1.php on line 71

    Hi all,

    This is my first post so i appreciate help. I'm new at php code so i'm unsure of the problem.

    I have the following html page containing php code. Im trying to access the page and when i do, i get this error:
    Parse error: parse error, unexpected T_INC in public_html/l8p1.php on line 71

    Code:
    <form name="input" method="get"  action="abc.aspx" >
    <fieldset>
    <legend>Order Information</legend>
    Quanties of Saws: <input type="text" id="quantitiesofsaws" /><br>
    Quantities of Hoes: <input type="text" id="quantitiesofhoes"/><br>
    Quantities of Planers: <input type="text" id="quantitiesofplaners"/><br>
    First Name: <input type="text" id="firstname"><br>
    Last Name: <input type="text" id="lastname"><br>
    Shipping Address: <input type="text" id="shippingaddress"><br>
    City: <input type="text" id="city"><br>
    State: 
    <?php
     
     $db=pg_connect("dbname=webdev");
     $query = "select state_abbr, state_name";
     $query .= " from state";
     $query .= " order by state_name;";
     $dbResult = pg_query($query);
     if (!$dbResult)
      { 
     	die("Database error...");
      }
     $num = pg_num_rows($dbResult);
     if ($num == 0) 
      {
      	echo 'Database Query Retrieved Nothing!';
      }
     $i = 0;
     while ($i < $num) 
     {
     	$abb = pg_Result($dbResult, $i, 'state_abbr');
     	$state = pg_Result($dbResult, $i, 'state_name');
     	echo "<select name='state'>";
     	echo "<option value={$abb}>{$state}</option>";	
     	i++;               <--- This is line 71
     }
     echo "</select>";
    
    ?>
    <br>
    Zip Code: <input type="text" id="state"><br>
    Last edited by wightfaux; Nov 17th, 2013 at 01:47 PM.

  2. #2
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    188

    Re: Parse error: parse error, unexpected T_INC in ..../8p1.php on line 71

    its clear that u have to use "$" in it so it will be like this
    PHP Code:
    <form name="input" method="get"  action="abc.aspx" >
    <fieldset>
    <legend>Order Information</legend>
    Quanties of Saws: <input type="text" id="quantitiesofsaws" /><br>
    Quantities of Hoes: <input type="text" id="quantitiesofhoes"/><br>
    Quantities of Planers: <input type="text" id="quantitiesofplaners"/><br>
    First Name: <input type="text" id="firstname"><br>
    Last Name: <input type="text" id="lastname"><br>
    Shipping Address: <input type="text" id="shippingaddress"><br>
    City: <input type="text" id="city"><br>
    State: 
    <?php
     
     $db
    =pg_connect("dbname=webdev");
     
    $query "select state_abbr, state_name";
     
    $query .= " from state";
     
    $query .= " order by state_name;";
     
    $dbResult pg_query($query);
     if (!
    $dbResult)
      { 
         die(
    "Database error...");
      }
     
    $num pg_num_rows($dbResult);
     if (
    $num == 0
      {
          echo 
    'Database Query Retrieved Nothing!';
      }
     
    $i 0;
     while (
    $i $num
     {
         
    $abb pg_Result($dbResult$i'state_abbr');
         
    $state pg_Result($dbResult$i'state_name');
         echo 
    "<select name='state'>";
         echo 
    "<option value={$abb}>{$state}</option>";    
         
    $i++;             //  <--- This is line 71
     
    }
     echo 
    "</select>";

    ?>
    <br>
    Zip Code: <input type="text" id="state"><br>
    Good Duck
    Body Language tells the truth! even from the grave tsaeb eht morf gninnur ,nwod deaH
    All the big things started from little! teef my tsap evom sekans ,duol raor slluB
    Lietome.ir

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2013
    Posts
    2

    Re: Parse error: parse error, unexpected T_INC in ..../8p1.php on line 71

    Hi thank you!! i caught that error but now i've run into another, i've updated the php part of my code, it looks like this now...
    Code:
    <form name="input" method="get"  action="abc.aspx" >
    <fieldset>
    <legend>Order Information</legend>
    <table border=1 cellpadding=5px cellspacing=3px>
    <tr>
    <th>Name</th>
    <th>Price</th>
    <th>Shipping Weight</th>
    <th>Quantity</th>
    </tr>
    <?php
      
      $db=pg_connect("dbname=webdev");
      $query = "select hdw_part_no, hdw_name, hdw_price,hdw_weight";
      $query .= " from hardware_t";
      $query .= " order by hdw_name;";
      $dbResult = pg_query($query);
      if (!$dbResult) { 
        die("Database error...");
      }
      $num = pg_num_rows($dbResult);
      if ($num == 0) {
        echo '<tr><td colspan="4">';
        echo 'Database Query Retrieved Nothing!</td></tr>';
      }
      $i = 0;
      while ($i < $num)
      {
        $name = pg_Result($dbResult, $i, 'hdw_name');
        $price = pg_Result($dbResult, $i, hdw_price);
        $weight = pg_Result($dbResult, $i, hdw_weight);	
        echo "<tr><td><b>$name</b></td><td>$price</td><td>$weight</td>";
        echo "<td><input type="text" class="qty"/></td></tr>";           <--THIS IS LINE 36 IN MY PROGRAM.
       $i++;
      }
     
    ?>
    </table>
    First Name: <input type="text" id="firstname"><br>
    Last Name: <input type="text" id="lastname"><br>
    Shipping Address: <input type="text" id="shippingaddress"><br>
    City: <input type="text" id="city"><br>
    State: 
    <?php
     
     $db=pg_connect("dbname=webdev");
     $query = "select state_abbr, state_name";
     $query .= " from state_t";
     $query .= " order by state_name;";
     $dbResult = pg_query($query);
     if (!$dbResult)
      { 
     	die("Database error...");
      }
     $num = pg_num_rows($dbResult);
     if ($num == 0) 
      {
      	echo 'Database Query Retrieved Nothing!';
      }
     $i = 0;
     echo "<select name='state'>";
     while ($i < $num) 
     {
     	$abb = pg_Result($dbResult, $i, 'state_abbr');
     	$state = pg_Result($dbResult, $i, 'state_name');
     	
     	echo "<option value={$abb}>{$state}</option>";	
     	$i++;
     }
     echo "</select>";
    
    ?>
    <br>
    Zip Code: <input type="text" id="state"><br>
    Phone Number: <input type="text" id="phonenumber"><br>
    </fieldset>
    <fieldset>
    <legend>Payment Type</legend>
    <input type="radio" id="paymentmethod" value="visa">Visa<br>
    <input type="radio" id="paymentmethod"
    value="mastercard">Mastercard<br>
    <input type="radio" id="paymentmethod"
    value="americanexpress">American Express<br/>
    Card Number: <input type="text" id="cardnumber"/><br/>
    </fieldset>
    <input type="submit" value="Submit" onclick="return validateForms();" />
    </form>
    
    </body>
    </html>
    And im receiving this error :

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/zglass/public_html/l8p1.php on line 36
    Can you help clarify please, im sure im not missing a "," or ';'.

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Parse error: parse error, unexpected T_INC in ..../8p1.php on line 71

    You need to escape your quotes, or wrap the line in single quotes.

    Example:

    Code:
    //escape the quotes
    echo "<td><input type=\"text\" class=\"qty\"/></td></tr>"; 
    
    //wrap in single quotes
    echo '<td><input type="text" class="qty"/></td></tr>';

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width