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. Link to comment https://forums.phpfreaks.com/topic/211377-calculator-script-not-executing/ 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 Link to comment https://forums.phpfreaks.com/topic/211377-calculator-script-not-executing/#findComment-1102130 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. :/ Link to comment https://forums.phpfreaks.com/topic/211377-calculator-script-not-executing/#findComment-1102131 Share on other sites More sharing options...
Pikachu2000 Posted August 21, 2010 Share Posted August 21, 2010 It happens to everyone occasionally. Link to comment https://forums.phpfreaks.com/topic/211377-calculator-script-not-executing/#findComment-1102138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.