Jump to content

Javascript & PHP


Canman2005

Recommended Posts

Dear all

I 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.

Thanks

Ed
Link to comment
https://forums.phpfreaks.com/topic/4830-javascript-php/
Share on other sites

[!--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=200

then in the same page you use php to get the variable:

<span class='total'><? echo $_GET['yourvariable'];?> </span>
[/quote]
Thanks, worked great
Link to comment
https://forums.phpfreaks.com/topic/4830-javascript-php/#findComment-16997
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.