Beginner PHP Question - Simple Calculator
I'm trying to make a simple calculator in PHP. I have done one according to some yt tutorial which was helpful, but the calculator was quite bland. Now I'm trying to make a nicer one, so I decided to change the <select> in html for some customized css buttons. All is fine in this regard, but when I get to the php part... I have assigned each of my buttons as so: <button type="submit" name="op1" value="op1" class="myButton">+</button> <button type="submit" name="op2" value="op2" class="myButton">-</button> <button type="submit" name="op3" value="op3" class="myButton">x</button> <button type="submit" name="op4" value="op4" class="myButton">÷</button> and I tried dealing with it like this: if (isset($_GET['submit'])){ //check if any button has been pressed $nmb1 = $_GET['num1']; // get the 1st number the user wrote $nmb2 = $_GET['num2']; //get 2nd number the user wrote $opr = $_GET['op1'] || $_GET['op2'] || $_GET['op3'] || $_GET['op4']; And then I'm stuck here... Apparently variables don't work like this but I'd like for $opr value to read according to the button which has been pressed. I'm not sure how to code this and I'm assuming this is the part of the code that isn't letting it work... After that, I have a switch case to output according to the operation selected. Can anyone enlighten me with any tips as to how do I proceed? Or at least how could I phrase this for a google? I looked up some things about variables and $_GET in php but still having a hard time figuring this out.