PHP Code, Variables & CSS. Would this work?

Hello,
I am new to PHP, this is my first script I have made without any help, I am using xammp to test my site, but the basics of the code is this. I am adding an include code into the navigation menu and in the CSS I have defined certain rules for the nav. Now in the code when you click on one of the links, it will change the variable to a corresponding number. The Code is pretty much self explanatory.
Menu.php:
<?
$active = 1;
?>   
    <ul>
      <li><a href="#"  onclick="<? $active = 1; ?>" class="<? if ($active = 1){?>#navigation ul li a.active<? } ?>">Portfolio</a></li>
      <li><a href="#"  onclick="<? $active = 2; ?>" class="<? if ($active = 2){?>#navigation ul li a.active<? } ?>">Web Examples</a></li>
      <li><a href="#"  onclick="<? $active = 3; ?>" class="<? if ($active = 3){?>#navigation ul li a.active<? } ?>">Contact Me</a></li>
    </ul>
Menu CSS:
#navigation { text-align: right; font-weight: bold; text-transform: uppercase; font-size:14px; line-height:18px; height:70px;}
#navigation ul{ list-style-type: none; }
#navigation ul li{ display:inline; padding-left:15px; }
#navigation ul li a{ text-decoration: none; color:#fff; }
#navigation ul li a:hover,
#navigation ul li a.active { color:#ffe6a5; }
Now what I want to happen is when you click on one of the links, it will change to active, changing the color of the text to tell the visitor that, that link is active. Now normally I would do it though CSS, changing the texts rule to the active, but in order to be able to change buttons without having to do it though all the pages and also because I want to start using PHP more.
The Include works, as you can see below, but the code above does not work, because the home button should be a light yellow color.

I can't comment on your PHP, but you can achieve your desired result quite simply using this demo from Nancy.
http://alt-web.com/Articles/Persistent-Page-Indicator.shtml

Similar Messages

  • HT204053 My husband and I both have iPhones but we only have one iPad. We use the same apple ID because we also share the same email address. How would this work with iCloud because we don't share the same contacts?  Thanks Elainecontacts

    My husband and I both have an iPhone and we share an iPad. We also share the same email address so how would this work with iCloud because we don't share all the same contacts?
    Thanks

    An icloud account is designed to be used by one user.  That user can have all his/her devices synced with the same Apple data (email, contacts, calendars, notes, reminders, etc.) .  When two people use the same account, then problems usually occur when one user edits data that the other user doesn't want changed on their device.  You can continue sharing the same ID for the itunes account in order to share the purchased music, apps, etc.  itunes accounts and icloud accounts are different.
    It's by far better that each user has his/her own icloud account.

  • I have an imac bought late 2013, can i use it as a display for the new mac pro? I also want to use windows 8 on it, would this work with parallels or bootcamp?

    I have an imac bought late 2013, can i use it as a display for the new mac pro? I also want to use windows 8 on it, would this work with parallels or bootcamp?

    Yes, it supports target display mode. Windows can be run with either Parallels or Boot Camp.

  • I want to get another 4s and use it not as a phone, but only as a video camera and editor and hook it up only with wifi. i would sync it to itunes so i can pay for apps and upload. would this work, or must it be connected to a phone carrier?

    I want to get another 4s and use it not as a phone, but only as a video camera and editor and hook it up only to wifi. i would sync it to itunes so i can pay for apps and upload. would this work, or must it be connected to a phone carrier?

    Trust me when I say this coming from 20 years of experience.
    Get a powered external drive, format it 1 Partition Option: GUID and OS X Extended Journed as the format in Disk Utility.
    Download and install Carbon Copy Cloner, clone internal drive to external drive.
    Set a schedule to remind you to do it at least once a week, keep it near your charger.
    When you plug your charger in, do plug the clone and power the machine up, set the display to sleep only,
    CCC will do the rest.
    If you want to boot from it, hold the option/alt and select it Startup Manager.
    I've seen many TimeMachine and TimeCapsule nightmares and so far haven't seen a problem from anyone using a bootable clone.
    It's simple, it's easy, it's more reliable and more powerful than what Apple does and it only takes plugging in a extra cable.
    Make as many clones as you want, keep them time seperated, off site etc. etc.
    Cables don't have network issues, clones can be verified in seconds merely by booting from them.
    Clones protect your productivity, your up in seconds on a clone despite even the hard drive dying.
    Software problem? No sweat, boot of the clone and reverse clone your problems away.
    If you want to fuss and muss with half implemented TimeMachine and TimeCapsule network headaches then prepare to suffer.
    I don't like to suffer, I bought a Mac not to suffer, but it appears you do with TimeMachine and TimeCapsule.
    Most commonly used backup methods

  • [WS-C3850-12S-E]---[WS-C2960X-48FPD-L]---[AIR-CAP2702I-x-K9] , Would this work?

    Does the Cisco Catalyst 3850 support indirectly connected access points?
    [WS-C3850-12S-E]---[WS-C2960X-48FPD-L]---[AIR-CAP2702I-x-K9]
    Would this work in any way?

    NO it will not work. AP must be directly connected to the 3850 for it to work in MA or MC mode.
    Regards
    Dont forget to rate helpful posts

  • Upgrade Error 1604 - Would this work to get iphone OS 3.0 running?

    Last week, I tried to update my iPhone 3G with the new 3.0 OS only to get the 1604 error and what I had originally thought was a bricked iPhone. After some digging on these forums, I figured out how to revert back to the older OS. I found it on the internet, downloaded it, and then restored my iPhone using that. My question is, if I were to go about manually downloading the 3.0 OS from the internet to my computer, and then restoring my iPhone using it, would it work? My god, all I want to do is have the new OS on my iPhone! What the heck is going on?

    I can send invitations and accept invitations through my Exchange Calendar, but not through my gmail CalDav?
    Why would this be removed and not included? Is this feature going to be added next year and advertised as some new feature that other phones don't have, like cut and paste? My Dell PoctetPC from 2000 has cut and paste...
    Come on Apple - listen to users and bring in all of the basics! You want this to be fully recognized in the Enterprise - CalDav meeting invites are going to be necessary!

  • I want to try and keep my iMac cooler , would this work ..?

    My new iMac 24 inch is working fine , the only thing is its getting very hot on the casing at the top, I think this may be due to the fact it is working in a very hot room, the iMac sits on a nice and clear desk top well away from the wall , the room is well ventilated with all the windows open, but the room temperature get’s very hot and there’s no room air conditioning . I was wondering if I placed a fan on the desk top
    To blow some air onto the iMac’s case , this may help reduce the machine from getting hot ..? . Where does the iMac draw its cooling air from , the bottom or top of the casing..? and do you think that putting a fan on the desk would reduce the iMac’s
    Casing temperature in any way ..?

    Is the ambient temperature within the operating limits stated for the iMac? (Operating temperature: 50°F to 95°F - 10°C to 35°C) If so, why worry about some Heath-Robinson cooling arrangment. If the heat is being dissipated out of the iMac then it's doing the job it's designed to. 
    If you look at the iStat Pro widget:
    are there any that are actually higher than they should be. The metal case of the iMac acts as a heat-sink so it will feel warm in places whereas other computers may be far hotter inside but feel cooler to the touch.
    mrtotes

  • AX as a ADSL router & bridge - would this work?

    I actually use a wired (ethernet) bound ADSL router, and an AXn wireless station, connected to the wired network, which includes an ethernet enabled laser printer and an MacMini used as a backup machine.
    I would like to replace the ADSL router by another AXn, which would use its ethernet port as a WAN port and be connected as a remote WDS base to the existing AXn.
    Basically this would look like this
    Internet (WAN) <---> AXn (new) <........> AX (existing <----> wired ethernet network
    1. Is this feasible?
    2. How should I configure the wireless side of the new AX connected to the WAN ?
    Thx in advance

    2. How should I configure the wireless side of the new AX connected to the WAN ?
    The new AXn's Ethernet port will need to be connected to your ADSL modem by Ethernet cable. If your ISP requires PPPoE credentials (username/password) in order to access their service, you would need to configure the AXn with these credentials through the AirPort Utility.

  • Animation: would this work?

    Say you want do make a cartoon, the old way. You draw all the cells, photograph them, and load them all in sequence into Imovie.
    It won't play as a smooth animation because you can't reduce the screen duration of a still shot down to 1/25th of a second.
    But if instead of taking a photo of each cell, what if you take a very short burst of video of each one, and load all those little video segments into Imovie. Then, you delete all frames of each segment except ONE. Shouldn't that leave you with a series of single frames, each of a different animation cell, that will run as a smooth animation when you hit play?
    I wanted to ask before I start. It'll take a loooong time, I know.

    ... I want "Disney-smooth. ...Disney? that WAS the company doing cell anim, right....?
    ok, the Disney classics as "Snowwhite" were painted every cell (not easy to get: the DVD has some "making of", showing the REAL Snowwhite.. forgot the actress' name, and how they used that as a blueprint for the paintings..), but most productions do 1:2/1:3 or higher.. the cheap Asian production do a mixture, they use realtime camera movements and some computer aided animations..... do some research with DVDs of your favorite, use the frame-forward-feature of your player, you'll be surprised…
    I can' recommend any good book (I'm sure, there are many), my knowledge is a collection from the last 30y I'm interest in that topic...-
    happy painting, "Disney smooth" (<< I like that term!) is 24 paitings per second (doing that with video, you do 25/30fps)... maybe that is the true reason why the gave up that part of the company... besides: a shame! they earn enough money with the productions of Pixar...
    I would spend some money on that boink… ploink… boom… what's its name??... software......esp. "onioning" is very easy done with video+Mac...
    A Mac is just a tool, but with your talent... probably, you'll be the next Carl Barks (ok, he never did animations, but he was THE BEST at Disney...), it was Georg Lucas, who said, he's afraid of these new "Garage Movie Makers". ;-))

  • PHP URL Variable from Insert Record Issue

    I have a very simplistic forum style website I have put together. Everything is functionally properly except for one aspect. The basic structure is a page that lists the existing threads (ie: ThreadA, ThreadB, and ThreadC). I have the name of these threads stored in a MySQL database table that is used to generate a repeating dynamic table to grow as the number of threads increases. If the user clicks on one of these links they are taken to a page that displays all of the comments pertaining to that thread. All of the comments are stored in another MySQL database table. I perform a query on this comments page to filter the information in the comments database by the thread name which is passed over from the first page via a URL variable. The link attached to the name of the thread in the repeating table that generates the URL variable is "comments.php?thread=<?php echo $row_threads['threadName']; ?>" This works perfectly, If the user clicks on ThreadB they are taken to the comments page where only the comments pertaining to ThreadB have been filtered and displayed. After the user inserts a comment form ThreadB the comments page reloads displaying the newly created comment.
    Also, on the first page, the user has the option to create a new thread; call it ThreadD. The name of this new thread has to be inserted into two tables; one in the master threads table and one in the comments page any time someone adds a comment. (I'm sure there is a better way to structure this, but this was all I could figure out and for my purposes at hand it is sufficient). When the user is taken to this new comment page I have a query set up to pull the last entry in the threads table from the logged in user, ie the newly created thread topic. I have dragged this query to the page to make sure it is pulling the correct thread heading, and it works just fine. What I'm wanting to have happen is after the user enters the first comment I'm wanting them to be redirected to the main comments page with their new comment listed; giving the illusion that the new comment and existing comments page are the same. I'm trying to pass the newly created thread name, ThreadD, in the URL to the main comments page just like I do if they select it from the existing threads page. Under the insert record wizard I click the 'browse' button to select the comments.php page. I then select 'parameters' to add the thread name query as the URL parameter. The generated code is "comments.php?thread=" . $row_threadName['threadName'] . "". The user does go to the main comments page but the URL variable is not coming with it. What I'm left with in the address bar is ..."/comments.php?thread=&" , but it should be ..."comments.php?thread=ThreadD". I tried copying and pasting the URL link from the existing threads page since that works perfectly, and when I do that the main comments page shows up blank after being redirected from the new comments page. If I hard code this, for testing purposes, into the redirect after insertion section (ie: "comments.php?thread=ThreadD") everything works perfectly and the URL in the address bar of the main comments page is "...comments.php?thread=ThreadD&" I noticed the extra "&", but didn't give it much thought since the site is giving me the behavior I'm looking for. My question is, how do I get this new comment page to pass the variable of the newly created thread name to the main comments page to behave like it does when the thread is selected from the list of existing threads? I know it has to do with how the URL variable is either being generated or built from my query, or how I have it listed in the redirect section of the insert wizard, but I can't figure out where I am going wrong. Please let me know if there are any questions or if I need to clarify any aspect. Any and all help is always appreciated. Thank you.

    Ok, so just to summarize so I am understanding this correctly.  You have an ordering page for tires/wheels.  A customer places an order for tires/wheels and the data is submitted successfully and this includes a symbol for measurement (in.).  But on another summary page the symbol is returning a blank value.
    If this is correct we need to see:
    - First, the code that is inserting the symbol to the database table in question
    - Second, the query and code where you are printing the data to the screen.

  • Php code is not working as intended in a simple spam block solution

    Hi. I'm trying to get some simple php code (as suggested on a tutorial page I found) to work on my form submission test page in order to reduce/stop spam. However, the results so far have not quite been what I expected. Any help will be appreciated.
    Basically I used the code given in the two grey boxes on this tutorial page http://myphpform.com/form-spam.php (but had to add this <?php ... ?> around the code given in the second box, otherwise it wouldn't have worked!) for my test page, and the result was supposed to look something like shown on this page http://myphpform.com/contact.php and indeed when I previewed my page in offline mode it displayed as intended with the extra field similar to the "Access code:" as on this example page, however that's not what I got when I uploaded my page.
    What happens when I go to the live page is that as soon as it loads it gives me the message: "Wrong access code" before I even have a chance to look at the form there. It's the message the user is supposed to get when they input the suggested code incorrectly, but not when the page first loads! This is what the live test page basically looks like when I go to it http://www.scotiauk.com/contact/forms/smotsContactTest.php. I wonder what's going wrong?
    I actually noticed a short while ago, after 'viewing page source' (source code) on the live test page that the page is for some reason only displaying less than half of the html code and cuts off the rest of it (including all of the <body>) just at the point (at the end of the <head> section) where the couple of lines of php script (borrowed from the second grey box in the tutorial) were meant to be - the script that includes "Wrong access code". So I get why it shows a blank page with only that message in it but not why it removes all of the <body> code once it is live!
    Just for information, this is what the page is really meant to look like - minus the php code: http://www.scotiauk.com/contact/forms/smotsContact.html. That is the original page that I copied and tried to modify with the new code. So, any ideas will be appreciated, thanks!

    Just for information, this is what the page is really meant to look like - minus the php code: http://www.scotiauk.com/contact/forms/smotsContact.html. That is the original page that I copied and tried to modify with the new code. So, any ideas will be appreciated, thanks!
    The page that you have quoted contains an infection as the following warns.
    As far as your problem is concerned, you need to know how a from works. Have a look at this video.

  • How to write this sql query in php code ?

    for example:
    insert into temp
    select *
    from testtable;
    after this, i will query data from sql below:
    select *
    from temp;
    how to write this php code ?
    who can help me ?
    thanks!

    Have a look at the manual to find out how to issue queries.
    http://us3.php.net/oci8

  • Would this Adapter work?

    Hi, I've recently acquired a new macbook pro.
    I have a samsung LCD TV that has a HDMI input. (the model no. for TV is SyncMaster 2032mw)
    If I buy this: http://cgi.ebay.co.uk/Mini-DisplayPort-to-HDMI-ADAPTER-Display-Port-CONVERTERW0QQitemZ110469845389QQcmdZViewItemQQptZUK_Computing_CablesConnectors_RL?hash=it em19b884118d#ht_9496wt941
    and connect everything up, would it work?
    Thanks

    It should, though you won't get audio through the HDMI input and will need to run the audio separately. If you will be using a separate audio system that won't be a problem, but if you need to use your TV's speakers, you'll need to check your TV to see if it can accept audio via another input when using the HDMI input for video; not all TVs can. If yours can't, you'll need this:
    http://kanexlive.com/products/item.aspx?id=3495
    Regards.

  • I am trying to import external CSS in Edge Animate, Has anyone got a "simple" example showing this working that I could have a look at?

    I am trying to import external CSS in Edge Animate, Has anyone got a "simple" example showing this working that I could have a look at?

    Hi Vivek,
    Thanks a lot for replying, actually i am creating a short LAMP animation. In which i used Blur filter on the fire flares(SVG images), everything works just fine on google chrome, but for IE10 & Firefox the filter seems not working, so i need to know is it possible to override the fallbacks for the Blur Filter through external StyleSheet.                            
    IE10 & firefox rendered Image, blur filter not working             Google Chrome rendered Image, blur filter working perfectly
    So, can you please guide me, what shall i do in maintaining quality of my graphics as well while such animation's.

  • Would this storage card work in the Media Card slot of my W700?

    Hi,
    I'm interested in buying this Lexar 133x SDHC Card:
    http://lexarmedia.com/products/lexar-professional-133x-sdhc-card?category=213
    Basicallyl, I want to use it as another storage drive (as opposed to putting in my camera or other device).  So after I insert it, I want to be able to format it and use it as another storage area.  Would this card work?
    The reason I'm gravitating to that card is that is that I see in the specs that is minimum 20MB/sec read transfer rate and it does not take up one of my USB slots.
    However, even if it does work, would I be better off with their Echo ZX plug-and-forget it USB drive when they ship it?:
    http://lexarmedia.com/products/lexar-echo-zx-backup-drive-0?category=90
    If both work, which would be faster as a storage drive?
    Thanks.

    It is a SDHC card so it should work on the card reader of the W700.
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

Maybe you are looking for

  • Pop/Imap retrieving and redistribute in LAN with OsX Server

    It's possible to download mail accounts hosted in my isp and redistribut'em in my lan with OsX Server with it's own mail server? The scope is not to have a local server mail because we have ADSL and sometimes the line broke up... We prefere have mail

  • Text message service center settings?

    Hi, I have a Samsung Galaxy S4. I am currently in the UK and inserted a pay-as-you-go SIM card from O2. After modifying the APN settings, I have been able to start using the phone and the internet - but unfortunately, my text messaging is not working

  • Process ID not bound

    Folks, i have reached an impass and any help/advice would be appreciated. Ive got an M5000 Domain running Sol10u5. Ive had a Fixed CPU pool running for some time now, and all working as it should. On Friday, I created 2 additional fixed cpu pools ( a

  • Play Button/Space Bar not working. . .

    Hello. . . I'm having difficulty navigating through clips that are in my timeline. The play button is not working. I've tried trashing my preferences several times, to no avail. . . any help would be greatly appreciated.

  • Ccess PHP files (.ctp) in with Dreamweaver

    Need to access PHP files (.ctp) in with Dreamweaver and SEO attributes.  For example, want to "Insert" Meta Keywords.  The files I am accessing have those fields "greyed-out" they are not available.  Is there a special setup in Dreamwever to access d