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
    Join Date
    Mar 2012
    Member #

    Parse error: syntax error, unexpected T_STRING

    Can I not use buttons in php?

    error:Parse error: syntax error, unexpected T_STRING in /xxx/xxx/xxx/xxx/xxx/template_pageTop.php on line 4

    All stuff in bold is line 4. If I remove the buttons and put something else there, the script works....
    // It is important for any file that includes this file, to have
    // check_login_status.php included at its very top.
    $login = "<button class="bluebtn" onclick="window.location = 'login.php';">Log In</button> &nbsp; | &nbsp; <button class="bluebtn" onclick="window.location = 'signup.php';">Signup</button>";
    if($user_ok == true) {
        $sql = "SELECT notescheck FROM users WHERE username='$log_username' LIMIT 1";
        $query = mysqli_query($db_conx, $sql);
        $row = mysqli_fetch_row($query);
        $notescheck = $row[0];
        $sql = "SELECT id FROM notifications WHERE username='$log_username' AND date_time > '$notescheck' LIMIT 1";
        $query = mysqli_query($db_conx, $sql);
        $numrows = mysqli_num_rows($query);
        if ($numrows == 0) {
            $envelope = '<a href="notifications.php" title="Your notifications and friend requests"><img src="images/note_still.jpg" width="22" height="12" alt="Notes"></a>';
        } else {
            $envelope = '<a href="notifications.php" title="You have new notifications"><img src="images/note_flash.gif" width="22" height="12" alt="Notes"></a>';
        $account = '<img id="cog1" src="images/cog1.png" alt="cog" onclick="togglecogwindow()">';
        $loginLink = '<a href="user.php?u='.$log_username.'">'.$log_username.'</a> &nbsp; | &nbsp; <a href="logout.php">Log Out</a>';
        $login = '';


  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Cottage Grove, Minnesota
    Member #
    725 times
    This line ...

    $login = "<button class="bluebtn" onclick="window.location = 'login.php';">Log In</button> &nbsp;

    should be ...

    $login = "<button class=\"bluebtn\" onclick=\"window.location = 'login.php';\">Log In</button> &nbsp";

    Normally you could do it as in line 18, but since you've already mixed double quotes with single quotes, it's just as easy to escape the double quotes within the string. Something about the onclick javascript doesn't look right either. The single quotes don't look to be in the correct place?
    Last edited by mlseim; Jun 18th, 2013 at 05:30 AM.

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 01:24 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: