Jump to content

Math not working? I'm really messing up somewhere and I am not sure what -simple


jacomus

Recommended Posts

I think it is probably something simple I am missing, I am fairly new to PHP and am putting together a page while doing different experimentation with the language.

 

My problem is that I have a user input for two numbers from a drop down menu.

 

$number1 is the variable from the first menu

$number2 is the variable from the second menu

$total = $number1 - $number2;

 

However, I always seem to get $total = $number1

 

It completely ignores the subtraction. I.E. If $number1 is 15 and $number2 is 4

Hitting the send button will get $total = 15 and not the expected value of 11.

 

Is there something I am, perhaps, missing?

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.