incorporating JS in dynamic php?
Posted: Fri Feb 22, 2008 10:19 am
I'm creating a dynamic html select list with:
However, I wish to incorporate a JS change event along the lines of: onChange="document.location.href='1.php'";
But I'm not sure how to incorporate this into my php. Any pointers would be much appreciated.
Code: Select all
// --- build default list ----------
$select_list = "<select name='type' id='type'>";
for($x = 0; $x < count($select); $x++)
{
if($x == 0)
{
$select_list .= "<option value='$select[$x]' selected>$select[$x]</option>";
} else {
$select_list .= "<option value='$select[$x]'>$select[$x]</option>";
}
}
$select_list .= "</select>";
But I'm not sure how to incorporate this into my php. Any pointers would be much appreciated.