Author Topic: Help with the isset function  (Read 109 times)

0 Members and 1 Guest are viewing this topic.

Offline DoubleaTopic starter

  • Irregular
    • View Profile
Help with the isset function
« on: July 21, 2010, 09:52:27 AM »
Hi guys,

Hope everyone is well!

I'm currently using Facebook Connect for a feature on our site. I am trying to show the text 'You are not logged in' if you are not logged in when you click on 'Attend this event' button.

I have figured out how to show that i you are logged in and you click on the button it shows "You are now attending this event".

The code for this is:

Code: [Select]
<?php if (isset($attendEvent)) { ?>
            <br />
            <b style="color: red">Your now attending the event! <?=$attendEvent['/127573637277755/attending']?></b>
           
         <?php ?>

I am trying to add code so that when you click the button and you are not logged in it it says 'You are not logged in' instead of 'Your now attending this event!'

Can anyone help with this? I tried else function but it showed up as soon as you landed on the page not after you clicked on the button.

Thanks :D

Offline gwolgamott

  • Enthusiast
  • Gender: Male
  • Yes I am wrong at times... that is the difference.
    • View Profile
Re: Help with the isset function
« Reply #1 on: July 21, 2010, 10:42:22 AM »
Use same method as you did before. Just put an exclamation point ! before isset()

<?php if (!isset($attendEvent)) { ?>

         <?php ?>
« Last Edit: July 21, 2010, 10:44:33 AM by gwolgamott »
I sit in the seat of Gods In the midst of the seas.

Offline DoubleaTopic starter

  • Irregular
    • View Profile
Re: Help with the isset function
« Reply #2 on: July 21, 2010, 11:12:06 AM »
Thanks gwolgamott - however it is still showing as soon as I go onto the page. I need it to be only visible once the button has been clicked but at the moment it is showing constantly?

http://www.wecantbehave.com/facebooktest/index.php is the link to see.

Any options?

Offline gwolgamott

  • Enthusiast
  • Gender: Male
  • Yes I am wrong at times... that is the difference.
    • View Profile
Re: Help with the isset function
« Reply #3 on: July 21, 2010, 11:39:55 AM »
Oh, I think I misread what you wanted. sorry.

If you are using sessions to keep track of who's logged in; then you could use session variables perhaps that keep track whether or not you are logged in and use that as the flag to display what you want.

http://us.php.net/manual/en/intro.session.php

I'd give more of an explanation but with sessions I'm a bit of a noob I don't deal with them often unfortunately to give good advice with regards to them other then to know when I should be using them... then I find someone who knows what they are doing lol
« Last Edit: July 21, 2010, 11:41:38 AM by gwolgamott »
I sit in the seat of Gods In the midst of the seas.

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.