have a little issue, trying to adapt and existin website to work off a template, all the products in the catalogue will just load to a defualt page and tadaa! now the images and rollovers and such were all coded in javascript before, but now I need to somehow have a mysql db query send the related variables to be substituted dynamically for these static variables:
//** TOP 2nd BAR //
OverImg[23] = new Image();
OverImg[24] = new Image();
OverImg[25] = new Image();
OverImg[26] = new Image();
OverImg[27] = new Image();
OverImg[28] = new Image();
//** TOP 2nd MENU //
OverImg[23].src = "nprod8/tmenu08o.gif";
OverImg[24].src = "nprod7/tmenu07o.gif";
OverImg[25].src = "nprod6/tmenu06o.gif";
OverImg[26].src = "nprod9/tmenu09o.gif";
OverImg[27].src = "nprod10/tmenu10o.gif";
OverImg[28].src = "nprod11/tmenu11o.gif";
//** TOP 2nd MENU //
NormImg[23].src = "nprod8/tmenu08.gif";
NormImg[24].src = "nprod7/tmenu07.gif";
NormImg[25].src = "nprod6/tmenu06.gif";
NormImg[26].src = "nprod9/tmenu09.gif";
NormImg[27].src = "nprod10/tmenu10.gif";
NormImg[28].src = "nprod11/tmenu11.gif";
that is all embedded in javascript now, but if I want those declared variables to be instead dependant on a products variable being passed to the template and then deciding what other images need to come with it, how could I change that to php or can javascript work just as easily with MySQL, I don't see how because of the client-side aspect of js.
I will have a query along the lines of:
$sql=mysql_query("select prod_category from products where prod_name = '$prod_name'");
$cat=mysql_fetch_array($sql)
$prod_cat=$cat["prod_category"];
$sql_l=mysql_query("select img_,img_2 from products where prod_category = '$prod_cat'");
mostly I am interested in knowing whether you can pass variables obtained through php code into js code?
any and all suggestions will be helpful