Jump to content

Archived

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

Canman2005

Javascript & PHP

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

Share this post


Link to post
Share on other sites
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>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.