Canman2005 Posted March 13, 2006 Share Posted March 13, 2006 Dear allI have a piece of javascript on my site which produces a value from a drop down list, if you select number 234 from the drop down, then it dynamically prints 234 on screen, it prints the value in between the tag<span id="total"></span>Is there anyway you can use php to add to the number which is printed on screen? Something like<span id="total"><?php echo +200 ?></span>I tried a few things but cant seem to get it to do what I want, thought I should ask here before I spend the week rewriting the script.ThanksEd Quote Link to comment https://forums.phpfreaks.com/topic/4830-javascript-php/ Share on other sites More sharing options...
fusionpixel Posted March 13, 2006 Share Posted March 13, 2006 Yes you can, what you need to do is pass the variable from the drop down to the new page so it looks like this:newpage.html?yourvariable=200then in the same page you use php to get the variable:<span class='total'><? echo $_GET['yourvariable'];?> </span> Quote Link to comment https://forums.phpfreaks.com/topic/4830-javascript-php/#findComment-16987 Share on other sites More sharing options...
Canman2005 Posted March 13, 2006 Author Share Posted March 13, 2006 [!--quoteo(post=354503:date=Mar 13 2006, 02:36 PM:name=fusionpixel)--][div class=\'quotetop\']QUOTE(fusionpixel @ Mar 13 2006, 02:36 PM) [snapback]354503[/snapback][/div][div class=\'quotemain\'][!--quotec--]Yes you can, what you need to do is pass the variable from the drop down to the new page so it looks like this:newpage.html?yourvariable=200then in the same page you use php to get the variable:<span class='total'><? echo $_GET['yourvariable'];?> </span>[/quote]Thanks, worked great Quote Link to comment https://forums.phpfreaks.com/topic/4830-javascript-php/#findComment-16997 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.