Jump to content

tridentmist

New Members
  • Posts

    3
  • Joined

  • Last visited

tridentmist's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. OK thanks, even when i change the values from "choice" to "pie" and "econs" it only goes to the pie option. How do I make it check to see if "e" was selected. and i fit was, then do the math for that option
  2. Honestly, I'm very new to this. this is the most recent code i've created. still doesn't work <?php $choice = $_GET['choice']; ?> <form id="s" method="post"> <label for="first">Constant To be Multiplied: </label> <select id="math" name="options"> <option value="nothing">Please select a constant</option> <option value="pie" <?php if (!empty($choice) && $choice == 'Option1') echo 'selected = "selected"'; ?>>Pi</option> <option value="econs"<?php if (!empty($choice) && $choice == 'Option3') echo 'selected = "selected"'; ?>>e</option> <option value="ratio" <?php if (!empty($choice) && $choice == 'Option3') echo 'selected = "selected"'; ?>>Golden Ratio</option> <option value="root" <?php if (!empty($choice) && $choice == 'Option4') echo 'selected = "selected"'; ?>>Root 3</option> </select> <br> <label for="fname">Number To be Multiplied: </label><input type="text" id="fname" name="value"><br> <input type="submit"> </form> <?php while ($_SERVER["REQUEST_METHOD"] == "POST"){ if (ctype_alpha($_POST["value"])){ echo "Please only input numbers"; exit; } else if (($_POST["value"] <= 0)){ echo "Please Enter Positive numbers only"; exit; } else if ($choicex = 'Option1'){ echo ($_POST['value']*pi()); exit; } else if ($choice = 'Option2'){ echo ($_POST['value']*exp()); exit; } } ?>
  3. I'm trying to code a drop-down menu that has four options; one for pie,exp, root 3, and the golden ratio.(all math values) Beside the drop-down menu, there is an option for user-inputted data, they must input only positive numbers. I must take there selected drop-down menu option and times it by the user inputted number. I'm not sure how to check which option the user chose. <form id="s" method="post"> <select id="math" name="options"> <option value="nothing">Please select a constant</option> <option value="pie">Pi</option> <option value="econs">e</option> <option value="ratio">Golden Ratio</option> <option value="root">Root 3</option> </select> <input type="submit" name="Submit" value="Send"> Everything That ive tried has failed
×
×
  • 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.