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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.