Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    if statement for login display

    hi all,

    am trying to get a login section to only display if the user have not logged in yet, and disappears if they are.

    PHP Code:
              <?php if(!(isset($_SESSION['MM_Username'])) { $loging_box "<td bgcolor='#000000'><form id='form1' name='form1' method='POST' action='<?php echo $loginFormAction; ?>'>";
              
    $loging_box .= "<span class='style114'>Membership Number<input type='text' name='textfield' /><br />Password</span><input type='text' name='textfield2' />";
              
    $loging_box .= "<br /><input type='submit' name='Submit' value='Login' /></form></td>";
              echo 
    $loging_box;}
    ?>
    am getting a parse error, on the first line, please help

  • #2
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Please could you post the error you are getting?

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Location
    Nigeria
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this:
    PHP Code:
    <?php
    if(!isset($_SESSION['MM_Username'])){
    //bracket use round ur isset wrong
    $loging_box "<td bgcolor='#000000'><form id='form1' name='form1' method='POST' action='$loginFormAction'>";
    /*this wrong - <?php echo $loginFormAction;?> too*/
    $loging_box .= "<span class='style114'>Membership Number<input type='text' name='textfield' /><br />Password</span><input type='text' name='textfield2' />"
              
    $loging_box .= "<br /><input type='submit' name='Submit' value='Login' /></form></td>"
              echo 
    $loging_box;

    ?>
    That should fix it.

  • #4
    New Coder
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the error code

    PHP Parse error: parse error, unexpected '{' in c:\...\XXX.php on line 1

  • #5
    New Coder
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the error code

    PHP Parse error: parse error, unexpected '{' in c:\...\XXX.php on line 1

  • #6
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts
    its becuase
    PHP Code:
    <?php if(!(isset($_SESSION['MM_Username']))
    Should be. . .

    PHP Code:
    <?php if(!isset($_SESSION['MM_Username']))

  • #7
    New Coder
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kehers
    Try this:
    PHP Code:
    <?php
    if(!isset($_SESSION['MM_Username'])){
    //bracket use round ur isset wrong
    $loging_box "<td bgcolor='#000000'><form id='form1' name='form1' method='POST' action='$loginFormAction'>";
    /*this wrong - <?php echo $loginFormAction;?> too*/
    $loging_box .= "<span class='style114'>Membership Number<input type='text' name='textfield' /><br />Password</span><input type='text' name='textfield2' />"
              
    $loging_box .= "<br /><input type='submit' name='Submit' value='Login' /></form></td>"
              echo 
    $loging_box;

    ?>
    That should fix it.
    Hi Thanks, i have fixed the second part, but i am not too sure what you mean by the wrong use of brackets, please can you explain further.

    thanks again

  • #8
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts
    he maeans the differnece in my post.

  • #9
    New Coder
    Join Date
    May 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks everyone, fixed


  •  

    Posting Permissions

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