Jump to content

[SOLVED] Can this JavaScript function be done in PHP?


Omzy

Recommended Posts

function goto(url)
{
var selection = document.getElementById('region');

if(selection.value != null)
{
document.location = url + document.getElementById('region').options[document.getElementById('region').selectedIndex].value;
}
}

 

<a href="/directory/'.$index.'/" onclick="goto(this.href); return false">'.$cat[$index][2].'</a>

 

'region' is a drop down box (HTML SELECT). What the function does is append the current value of 'region' to the end of the URL specified in the 'a href'. It does this onclick (not onpage load).

 

I was wondering could the same functionality be achieved using PHP? Perhaps using the header() function?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.