TheJoey Posted September 11, 2009 Share Posted September 11, 2009 I have a quick question. im using sessions in my shopping cart. Can i make it that if someone is not logged in that the sumbit buttons are disable or something similar. i want to give guest ability to view just not to sumbit. Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/ Share on other sites More sharing options...
trq Posted September 11, 2009 Share Posted September 11, 2009 As an example. if (isset($_SESSION['logged']]) { // show whatever } else { // show whatever else } Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-916553 Share on other sites More sharing options...
TheJoey Posted September 11, 2009 Author Share Posted September 11, 2009 can i call up a session from a previous page? And another thing could i implement the code you gave me as. if (isset($_SESSION['logged']]) { // show whatever (ALL CART CODE WITH SUBMIT BUTTONS) } else { (ALL CART CODE WITHOUT SUBMIT BUTTONS) } Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-916666 Share on other sites More sharing options...
MartinGr Posted September 11, 2009 Share Posted September 11, 2009 can i call up a session from a previous page? And another thing could i implement the code you gave me as. if (isset($_SESSION['logged']]) { // show whatever (ALL CART CODE WITH SUBMIT BUTTONS) } else { (ALL CART CODE WITHOUT SUBMIT BUTTONS) } What exactly do you mean with calling session from previous page? And yes, you can implement given code like that Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-916667 Share on other sites More sharing options...
kratsg Posted September 11, 2009 Share Posted September 11, 2009 As long as you put session_start() on the top of the pages you want to use sessions with... you're able to use the sessions that were created or changed on previous pages... Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-916671 Share on other sites More sharing options...
TheJoey Posted September 11, 2009 Author Share Posted September 11, 2009 Thanks guys just needed confirmation of it Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-916677 Share on other sites More sharing options...
rille95 Posted September 13, 2009 Share Posted September 13, 2009 can i call up a session from a previous page? And another thing could i implement the code you gave me as. if (isset($_SESSION['logged']]) { // show whatever (ALL CART CODE WITH SUBMIT BUTTONS) } else { (ALL CART CODE WITHOUT SUBMIT BUTTONS) } I don't think you should have all the code in that if statement. i think it would be better if you have all the code and then you do that if statement only for the submit button. i'm not the best php coder but i think it would be better that way. somethin like <?php (all cart code before the submit button) if (isset($_SESSION['logged']]) { (show submit botton) } else { (don't show submit button or some text like "please login") } (all cart code after the submit button) ?> Link to comment https://forums.phpfreaks.com/topic/173867-solved-session-question/#findComment-917582 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.