Jump to content

masonh928

Members
  • Posts

    3
  • Joined

  • Last visited

About masonh928

  • Birthday 09/28/1997

Previous Fields

  • Languages
    PHP(mediocre), Javascript, CSS, HTML

Contact Methods

  • Website URL
    http://www.tadfieldminipettingzoo.com

Profile Information

  • Location
    Indiana, USA
  • Interests
    Football, Basketball, Computers, barrel racing, Sports, Talking

masonh928's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. do I just delete $divide and $multiply. How is PHP supposed to figure out whether they chose division or multiplication...
  2. this to be exact Notice: Undefined index: multiply in /Applications/XAMPP/xamppfiles/htdocs/socialboard/calculator.php on line 4Notice: Undefined index: divide in /Applications/XAMPP/xamppfiles/htdocs/socialboard/calculator.php on line 5Notice: Undefined index: num_1 in /Applications/XAMPP/xamppfiles/htdocs/socialboard/calculator.php on line 6Notice: Undefined index: num_2 in /Applications/XAMPP/xamppfiles/htdocs/socialboard/calculator.php on line 7
  3. <html><form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">Number-1: <input type="text" name="num_1"><br>Multiply or Divide:<select><option name="multiply">Multiplly '*'</option><option name="Divide">Divide '/'</option></select><br>Number-2<input type="text" name="num_2"><br><hr><input type="submit" value="calculate" name="calculate"><input type="reset"></form><?php include 'nav.php';$multiply = $_POST['multiply'];$divide = $_POST['divide'];$num_1 = $_POST['num_1'];$num_2 = $_POST['num_2'];function calculate() {if(isset($multiply)){echo "The product is:"."($num_1 * $num_2)";}if(isset($divide)){echo "The quotient is:"."($num_1 * $num_2)";}}if(isset($_POST['calculate'])){echo calculate();}?></html>======================0r======================<html><?php include 'nav.php';$multiply = $_POST['multiply'];$divide = $_POST['divide'];$num_1 = $_POST['num_1'];$num_2 = $_POST['num_2'];function calculate() {//if they choose multiplicationif(isset($multiply)){echo "The product is:"."($num_1 * $num_2)";}//if they choose divideif(isset($divide)){echo "The quotient is:"."($num_1 * $num_2)";}}//see if they clicked the sunmit buttonif(isset($_POST['calculate'])){echo calculate();}?><form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">Number-1: <input type="text" name="num_1"><br>Multiply or Divide:<select><option name="multiply">Multiplly '*'</option><option name="Divide">Divide '/'</option></select><br>Number-2<input type="text" name="num_2"><br><hr><input type="submit" value="calculate" name="calculate"><input type="reset"></form></html>================================================+++++++++++++++++++++================================================It gives me notice: undefined index?This post has been edited by masonh928: Today, 04:59 PM calculator.php
×
×
  • Create New...