Jump to content

button help


marquel2k69

Recommended Posts

Hi all I need a little help how would I code a button in php that checks to see if you are logged in for example if the button was labled "my account" if you were logged in it would take you to "my account" but if you weren't logged in on the button roll over it would say log in and to you to the log in/register page thanks in advance for any help if php isn't what I should be using what should I use

Link to comment
https://forums.phpfreaks.com/topic/264328-button-help/
Share on other sites

The button will be created in HTML, but you can echo him with the php. Try something like that

 

<?php
function authenticate() {
    // Your authentication logic here
}

// If user is loged in
if(authenticate()) {
    echo '<a href="/user-acount">My account</a>';
}
// If user need to login
else {
    echo '<a href="/login">Log in</a>';
}

 

It will prints out a link. You can customize the link with CSS and an image, if you want to.

Link to comment
https://forums.phpfreaks.com/topic/264328-button-help/#findComment-1354639
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.