graham23s Posted May 18, 2010 Share Posted May 18, 2010 Hi Guys, I'm trying to pass the value of a bit of javascript via php, my code: <div style="width: 20px; height: 10px;"><a href="javascript:void(0)" onclick="theNumber++; document.getElementById('specqty').value = theNumber;"><img src="../images/spQtyUp.gif" width="20" height="10" border="0" alt="Up" /></a></div> <div style="width: 20px; height: 10px;"><a href="javascript:void(0)" onclick="theNumber--; if(theNumber<1){theNumber=1;}; document.getElementById('specqty').value = theNumber; "><img src="../images/spQtyDown.gif" width="20" height="10" border="0" alt="Down" /></a></div> <input type="hidden" name="qID" value="<?php echo ; ?>" /> document.getElementById('specqty').value i'm trying to print this value in the "hidden" qID field to be passed over one the "add to cart" button is pressed i'm not sure how to write the javascript value in the php echo part ( any help would be appreciated thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/202184-printing-javascript-value/ Share on other sites More sharing options...
jdavidbakr Posted May 18, 2010 Share Posted May 18, 2010 just add the id attribute to your input so you can access it via getElementById <input type="hidden" name="qID" id="specqty" value="<?php echo ; ?>" /> Link to comment https://forums.phpfreaks.com/topic/202184-printing-javascript-value/#findComment-1060206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.