Hello
Please bear with me, I am a php & javascript newbie still trying to learn.
Currently I have a page that dynamically create radiobuttons from a table in a MySQL database. These radiobuttons are
a list of business units for a company.
$result = mysql_query("SELECT Name FROM t_bizunits",$conn);
while ($myrow = mysql_fetch_array($result))
{
$bizcount += 1;
if ($myrow["Name"] == $_SESSION["bizunit"])
{
echo ("<label><inputtype=\"radio\"name=\"bizchoice\" value=\"{$bizcount}\" CHECKED onclick=reload({$bizcount}) >");
}
else
{
echo ("<label><input type=\"radio\" name=\"bizchoice\" value=\"{$bizcount}\" onclick=reload({$bizcount})>");
}
printf ($myrow["Name"]);
echo ("<br>");
}
I want it so that if the user clicks on the radiobutton it changes the session variable $_SESSION["bizunit"] to the selected
bizunit in the radiobutton and reloads the page.
Here is the JavaScript function reload:
echo ("function reload(biznr){");
// I want to change the session variable
// "bizunit" here.
echo ("document.location.reload()");
// This will then reload the page showing the details of the // currently selected bizunit
echo ("}");
echo ("</script>");
Anybody have an idea how I can achieve this? Any input will be appreciated.
Thanks in advance.
Please bear with me, I am a php & javascript newbie still trying to learn.
Currently I have a page that dynamically create radiobuttons from a table in a MySQL database. These radiobuttons are
a list of business units for a company.
$result = mysql_query("SELECT Name FROM t_bizunits",$conn);
while ($myrow = mysql_fetch_array($result))
{
$bizcount += 1;
if ($myrow["Name"] == $_SESSION["bizunit"])
{
echo ("<label><inputtype=\"radio\"name=\"bizchoice\" value=\"{$bizcount}\" CHECKED onclick=reload({$bizcount}) >");
}
else
{
echo ("<label><input type=\"radio\" name=\"bizchoice\" value=\"{$bizcount}\" onclick=reload({$bizcount})>");
}
printf ($myrow["Name"]);
echo ("<br>");
}
I want it so that if the user clicks on the radiobutton it changes the session variable $_SESSION["bizunit"] to the selected
bizunit in the radiobutton and reloads the page.
Here is the JavaScript function reload:
echo ("function reload(biznr){");
// I want to change the session variable
// "bizunit" here.
echo ("document.location.reload()");
// This will then reload the page showing the details of the // currently selected bizunit
echo ("}");
echo ("</script>");
Anybody have an idea how I can achieve this? Any input will be appreciated.
Thanks in advance.