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 Quote Link to comment 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 ; ?>" /> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.