Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,241 members, 7,860,548 topics. Date: Friday, 14 June 2024 at 12:25 PM

Can Php Do It. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Can Php Do It. (740 Views)

(2) (3) (4)

(1) (Reply) (Go Down)

Can Php Do It. by ajaxphp7: 3:44pm On Sep 29, 2010
On a profile page for Registering of Students, in the session, I have two links
1) Register for Student Union
2)See registered Information.
I actually want to make the Link See registered information unactive if Registration has not been carried out.
And also make the link Register for student Union Unactive when Registration has been carried on in the session of the student.
What tool am I supposed to use.
I used php to write the script and using mysql at the back end. Can Php do it?
Any Idea will be appreciated.
Re: Can Php Do It. by Nobody: 4:00pm On Sep 29, 2010
Obviously Session will be Good since it is accessible through out the whole Page

Case Work:

Where the Link should be

<?php
//if the registered session has been set meaning he has registered

if(isset($_SESSION['registered_information']) && (!is_null($_SESSION['registered_information'])):

//print obviously meaning he has registered
print <a href="viewinfo">View Profile</a>
else: {?>
//meaning He has not Registered strip off the <a href> because with firebug u can alternate attributes i do it alot
<p>View Profile</p>

<?php } endif;?>

i hope the idea helps u need to initialize session first before u can handle session variables








?>
Re: Can Php Do It. by yawatide(f): 4:35pm On Sep 29, 2010
A much cleaner, albeit some may argue, a little convoluted, way of doing it would be

1) you have 1 extra var: sessionValidText (for lack of a better name).

2) as part of your sniffing, if session exists and isn't null, you populate this sessionValidText with <p><a>view</a></p>  else, with  <p>view</p>

3) Your code would then simply print the var, like so: echo $sessionValidText

Advantages:

1) more readable: cleaner
2) more maintainable: little or no spaghetti code
3) absctraction: you separate logic (php) from content (html). This leads back to #2

good luck!
Re: Can Php Do It. by Nobody: 6:06pm On Sep 29, 2010
If PHP can't do it, then it should be scrapped as a Programming language for the web.

Used it for my site, so when people have logged in, they don't see that annoying login/signup in the homepage.

How is it done: Tell PC Guru to code it. Cause it's the same logic i used! Session!
Re: Can Php Do It. by ajaxphp7: 3:35pm On Oct 01, 2010
Thanks for The Idea PC-Guru, it helps.

(1) (Reply)

Upgrade By Shopping On-line From The Us And Pay In Naira! / Website Traffic Generation Made So Easy / Recaptcha Breacheable?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.