Submitting a value from a php selectbox
Posted: Fri Jun 17, 2005 6:13 am
Hi there,
I've an issue with sending a value from within a PHP function with onChange (javaScript)
My function does very well, exept for submitting the appropriate value. Virtually nothing happens
So here's the function:
Actually this function displays a selectbox wich generates a formatted output from a datetime mysql data type field.
I think that something like this should do:
..but all my attemts so far caused only Errors.
Some Genius out there?
Thanks
I've an issue with sending a value from within a PHP function with onChange (javaScript)
My function does very well, exept for submitting the appropriate value. Virtually nothing happens
So here's the function:
Actually this function displays a selectbox wich generates a formatted output from a datetime mysql data type field.
Code: Select all
// displays a selectbox with the db-record and appropriate labeling..
function database_select($tbl_value, $select_name, $label) {
global $DB_WE;
$menu = "e;<label for=\"e;"e;.$select_name."e;\"e;>"e;.$label."e;</label>\n"e;;
// here is the problem:
$menu .= "e;<select name=\"e;"e;.$select_name."e;\"e; onchange=\"e;document.location.href='"e;.$_SERVERї"e;PHP_SELF"e;]."e;?ViewYear="e; ?WHAT DO I HAV TO PUT IN HERE? "e;\"e;>\n"e;;
//end problem
$DB_WE->query("e;SELECT DATE_FORMAT(DateOrder,'%Y') AS DateOrder FROM "e;.SHOP_TABLE . "e; GROUP BY DateOrder"e;);
while ($DB_WE->next_record()) {
$menu .= "e; <option value=\"e;"e;. $DB_WE->f("e;DateOrder"e;)."e;\"e;"e;;
$menu .= (isset($_REQUESTї$select_name]) && $DB_WE->f("e;DateOrder"e;) == $_REQUESTї$select_name]) ? "e; selected=\"e;selected\"e;"e; : "e;"e;;
$menu .= "e;>"e; . $DB_WE->f("e;DateOrder"e;) . "e;\n"e;;
}
$menu .= "e;</select>\n"e;;
return $menu;
}Code: Select all
onChange="e;document.location.href=\"e;' . $_SERVERї'PHP_SELF'] . '?\"e; + this.name + "e;="e; + this.optionsїthis.selectedIndex].valueSome Genius out there?
Thanks