Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2006, 09:35 AM   PM User | #1
pinch
New Coder

 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
pinch is an unknown quantity at this point
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
pinch is offline   Reply With Quote
Old 08-30-2006, 09:56 AM   PM User | #2
Webmonkey
New Coder

 
Join Date: Apr 2006
Location: Tadley, UK
Posts: 63
Thanks: 5
Thanked 0 Times in 0 Posts
Webmonkey is an unknown quantity at this point
Please could you post the error you are getting?
__________________
Steven Gibbons
klearconcepts@gmail.com
Webmonkey is offline   Reply With Quote
Old 08-30-2006, 09:57 AM   PM User | #3
kehers
Regular Coder

 
Join Date: Mar 2006
Location: Nigeria
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
kehers is an unknown quantity at this point
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.
kehers is offline   Reply With Quote
Old 08-30-2006, 10:00 AM   PM User | #4
pinch
New Coder

 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
pinch is an unknown quantity at this point
This is the error code

PHP Parse error: parse error, unexpected '{' in c:\...\XXX.php on line 1
pinch is offline   Reply With Quote
Old 08-30-2006, 10:00 AM   PM User | #5
pinch
New Coder

 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
pinch is an unknown quantity at this point
This is the error code

PHP Parse error: parse error, unexpected '{' in c:\...\XXX.php on line 1
pinch is offline   Reply With Quote
Old 08-30-2006, 10:04 AM   PM User | #6
Webmonkey
New Coder

 
Join Date: Apr 2006
Location: Tadley, UK
Posts: 63
Thanks: 5
Thanked 0 Times in 0 Posts
Webmonkey is an unknown quantity at this point
its becuase
PHP Code:
<?php if(!(isset($_SESSION['MM_Username']))
Should be. . .

PHP Code:
<?php if(!isset($_SESSION['MM_Username']))
__________________
Steven Gibbons
klearconcepts@gmail.com
Webmonkey is offline   Reply With Quote
Old 08-30-2006, 10:07 AM   PM User | #7
pinch
New Coder

 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
pinch is an unknown quantity at this point
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
pinch is offline   Reply With Quote
Old 08-30-2006, 10:08 AM   PM User | #8
Webmonkey
New Coder

 
Join Date: Apr 2006
Location: Tadley, UK
Posts: 63
Thanks: 5
Thanked 0 Times in 0 Posts
Webmonkey is an unknown quantity at this point
he maeans the differnece in my post.
__________________
Steven Gibbons
klearconcepts@gmail.com
Webmonkey is offline   Reply With Quote
Old 08-30-2006, 10:12 AM   PM User | #9
pinch
New Coder

 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
pinch is an unknown quantity at this point
thanks everyone, fixed
pinch is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:15 AM.


Advertisement
Log in to turn off these ads.