unexpected T_VARIABLE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaymzlx
    New Member
    • Feb 2010
    • 4

    unexpected T_VARIABLE

    Heyas,

    I'm relatively new to php, and I have no clue as to where I have the syntax error in my php file. Wondering of you guys can help me out. Thanks!

    Parse error: syntax error, unexpected T_VARIABLE in /home/ruckusin/public_html/projects/vote_form.php on line 35

    Code:
    <?php
    // Displays voting form
    require_once("vote_config.php");
    $poll = $_GET['hockeypoll'];
    if (!is_numeric($poll))
      {
        die("Invalid poll");
      }
    
    // Look up the poll in the database
    $sql = "SELECT P.question, A.answer, A.answer_ID
              FROM hockeypoll P, answer A
             WHERE P.ID = $poll
               AND A.ID = P.ID";
    
    $result = mysql_query($sql, $db) or die ("mysql error: " . mysql_error());
    if (mysql_num_rows($result) == 0) 
      {
        die('Invalid poll');
      }
    
    // Show results if the user has voted
    if ($_COOKIE["poll_voted_$poll"]) 
      {
        header("Location: vote_tally.php?poll=$poll");
        exit;
      }
    
    // Create the voting form
    $question_list = "";
    while ($row = mysql_fetch_array($result)) 
      {
        $question = $row['question'];
        $question_list .= '<li><input name="answer" type="radio" value="' 
                          $row['answer_ID'] . '"> ' . $row['answer']
                          '</li>';
      }
    
    ?>
    <html>
    <head>Voting Form</head>
    <body>
    <span style="font-size: 12px;">
    <span style="font-weight: bold; font-size: 14px;">
        Poll #<?php print $poll; ?>
    </span><br />
    <span style="font-weight: bold"><?php print $question; ?></span>
    <form action="vote_process.php" method="post">
    <ul style="list-style-type: none;">
    <?php print $question_list; ?>
    </ul>
    <input name="poll" type="hidden" value="<?php print $poll; ?>">
    <input name="" type="submit" value="Vote!">
    </form>
    </span>
    </body>
    </html>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you’re missing the concatenation operators on lines #34 – #36

    Comment

    • jaymzlx
      New Member
      • Feb 2010
      • 4

      #3
      Hey thanks for the heads up. I was so tired and could not figure it out. Worked like a charm!

      Comment

      Working...