SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Displaying simple math inputted by variables...

    Can anyone tell me how to make a simple script to add variables? The math would look like:

    <?php print("$n"); ?>+<?php print("$s"); ?>-<?php print("$d"); ?>=SUM

    It would add the submitted values, and come up with a "score"

    Thanks,
    Josh

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why are you not doing it server side?

    <?php print("$n"); ?>+<?php print("$s"); ?>-<?php print("$d"); ?>= <?php print ($n + $s) - $d?>

  3. #3
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm... I never thought of that. I'm just a beginner to PHP and thought javascript would be the easiest way... I guess not!

    Thanks for your help

  4. #4
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it can be done either way, whatever works best for you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •