Update Cookie value through JavaScript onChange

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:

order by:

price lowest
price higest


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

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);


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

Howdy, Stranger!

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