Hello there,

It has been a good long while since I have visited Zymic (years in fact) but I have a question that I hope you can help me with.

I am mid-project, and have encountered a problem that I really am a little stuck with.

In my database, (in this example) let's say I have 5 fields. ID, NAME, LIVE, ADDRESS. Live is either set to 1 or 0 depending if it has any other active events.

Here's my problem.

I need users to be able to click or select something that will change if they are viewing only live or all results. Now I know that I could use cookies, and get a completely seperate form to just have an onsubmit to post to the file, thus setting a cookie to display if it's live or not.

That's fine, but there are about 20 files that need to be updated, and the lovely person that wrote them, was let's just say not the best coder in the world, and the source is horrible. I need something quick and easy that I don't have to mess about with too much, to just have a submit button, or even a check box to determine if the user wants to see all the results instead of just the live ones.

Now I do hope you understand the above, but just incase I have't made myself clear, here's what the PHP would be.

(if I did it in the way I am currently thinking)

CODE
<?php

// if form has been posted.

if(isset($_POST['live'])){

if(isset($_POST['check'])){
setcookie("project_live", "1", time()+3600);
} else {
setcookie("project_live", "0", time()+3600);
} // END if checkbox has been selected.

} // END if isset POST live.

?>

<form action='' method='post'>
<input type='checkbox' name='check' value='1'> <input type='submit' name='live' value='Go'>
</form>



The problem with it, is that it's not very nice, and I would have to change various things as per what page I am on.

I want to do it in javascript, so that it A.) Dosen't take me 5 minutes per file to integrate. & B works nicely.

Is there a better way?