Far Cry Posted August 21, 2010 Share Posted August 21, 2010 Hey there, I recently started working on a PHP calculator, I tryed testing it out and the script is not executing... *NOTE* I found the error, I forgot to assign values to the options, all is good now <?php /* Script Created by: Far Cry Started: August 20th, 2010 10:51 PM PST Completed */ $title = "Calculator"; $form = "<form action='calculator.php' method='POST'> <table> <tr> <td><input name='firstnumber' type='text'></td> </tr> <tr> <td><input name='secondnumber' type='text'></td> </tr> <tr> <td><select name='operation'> <option name='multiply'>*</option> </select></td> </tr> <tr> <td><input name='submitbtn' type='submit' value='Calculate!'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $first = ($_POST['firstnumber']); $last = ($_POST['secondnumber']); $operation = ($_POST['operation']); } if ($operation == 'multiply'){ echo"The answer is " . $first * $last . $form; } echo $form; ?> Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 21, 2010 Share Posted August 21, 2010 <option name='multiply'>*</option> // Change this <option value='multiply'>*</option> // To this Quote Link to comment Share on other sites More sharing options...
Far Cry Posted August 21, 2010 Author Share Posted August 21, 2010 <option name='multiply'>*</option> // Change this <option value='multiply'>*</option> // To this Thanks, I feel like an idiot. :/ Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 21, 2010 Share Posted August 21, 2010 It happens to everyone occasionally. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.