werushka Posted March 26, 2008 Share Posted March 26, 2008 I want to place a button that function as the following between this div <div class="linkbutton"> <?php global $user; if ($user->uid) { node/add/duyuru} (I want it to go to this page) else { /user/login (if the criteria is not met above go this page instead) } ?> </div> and if the current page is "node/add/duyuru" this div class should be hidden. I understand the logic but I have almost no idea how to write it. I would really appreciate any help Link to comment https://forums.phpfreaks.com/topic/98042-simple-php-controlled-button/ Share on other sites More sharing options...
soycharliente Posted March 26, 2008 Share Posted March 26, 2008 So like? <?php $where = $_GET['button']; switch ($where): case "something": header("Location: node/add/duyuru"); exit(); default: header("Location: /user/login"); exit(); ?> <div class="linkbutton"> <?php global $user; if ($user->uid) { echo "<a href=\"{$_SERVER['PHP_SELF']}?button=$user\">Click Me</a>"; else { echo "<a href=\"{$_SERVER['PHP_SELF']}?button=default\">Click Me</a>"; } ?> </div> Is that close to what you're trying to accomplish? Link to comment https://forums.phpfreaks.com/topic/98042-simple-php-controlled-button/#findComment-501641 Share on other sites More sharing options...
werushka Posted March 26, 2008 Author Share Posted March 26, 2008 I am kind of confused by your code... Basically I want to created a Link button on my navbar, with the div tag (which I can customize the look. My requirements are as follows, if the user is logged in then the button will lead the user to "node/add/duyuru"(this is a link) but if the user is not logged in and anyone clicks on the "link button" i created then it redirects the user to "/user/login" link so that can login to use the function of that link button... In the mean time it would be really nice so if the user viewing this page only "node/add/duyuru" then the button is not displayed at all... Thanks for your reply Link to comment https://forums.phpfreaks.com/topic/98042-simple-php-controlled-button/#findComment-501689 Share on other sites More sharing options...
werushka Posted March 27, 2008 Author Share Posted March 27, 2008 This part is understandable <div class="linkbutton"> <?php global $user; if ($user->uid) { echo "<a href=\"{$_SERVER['PHP_SELF']}?button=$user\">Click Me</a>"; else { echo "<a href=\"{$_SERVER['PHP_SELF']}?button=default\">Click Me</a>"; } ?> </div> But the part above I just want a rollover image, where can i define the "Button" Thanks Link to comment https://forums.phpfreaks.com/topic/98042-simple-php-controlled-button/#findComment-501843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.