Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Update Cookie value through JavaScript onChange

dengar81dengar81 Member Posts: 1
Hi there...

I have a search results page on my small website.
I want customers to be able to alternate between search views: relevancy, price up or down and latest products in the search results.

The search results are coming from a PHP class on page load and the PHP script checks what the customers preferred search order is by the cookie. The cookie is also initially set as "relevancy", so far so good...

Here is the form that I have:
[code]

order by:

relevancy
price lowest
price higest
newest



[/code]

OnSubmit I want the cookie to change and although I haven't been so far, reload the page...
[code]

function jsFnc_OrderView() {
var orderView = document.OrVw.view;
var d = new Date();
d.setDate(d.getDate() + 14);
document.cookie(srchOrder, orderView);
document.write("Order view: " + orderView);
}

[/code]

So as the view changes the script should be executed... I'm stuck however, as nothing happens.
Sign In or Register to comment.