Update page attribute value via script

Permalink
I have a page attribute checkbox labeled Active. When the box is selected, the page is listed as an active page. When the box is not selected the page is listed as inactive and its link is grayed out in my page list template.

What I need is, a button on the page that will activate or deactivate a page by modifying the page attribute. I have dug and dug on here trying to find how to do this and so far nothing I've found works.

So far, I've referenced my button to an element that has the script to update the attribute value and then a php header to return me to the page I'm working on. I can call to the element, it runs and brings me back if my script is commented out. With my update script active, it will not return me to the page I'm working on or run the script.

Maybe there is a better way to do this... any thoughts?

gtrhough