Jump to content


Photo

Javascript & PHP


  • Please log in to reply
2 replies to this topic

#1 Canman2005

Canman2005
  • Members
  • PipPipPip
  • Advanced Member
  • 669 posts

Posted 13 March 2006 - 02:28 PM

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

#2 fusionpixel

fusionpixel
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 13 March 2006 - 02:36 PM

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>
Did you know there is a manual for PHP? [a href="http://" target="_blank"]http://www.php.net[/a]
Did you know there is a manual for mySQL? [a href="http://" target="_blank"]http://www.mysql.org[/a]

#3 Canman2005

Canman2005
  • Members
  • PipPipPip
  • Advanced Member
  • 669 posts

Posted 13 March 2006 - 02:46 PM

[!--quoteo(post=354503:date=Mar 13 2006, 02:36 PM:name=fusionpixel)--][div class=\'quotetop\']QUOTE(fusionpixel @ Mar 13 2006, 02:36 PM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users