Search
 
SCRIPT & CODE EXAMPLE
 

PHP

calculator in php

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Answer</title>
</head>
<body>
<p>The answer is: 
<?php
if($_POST['group1'] == add) {
echo "$first + $second";
}
else if($_POST['group1'] == subtract) {
echo "$first - $second";
}
else if($_POST['group1'] == times) {
echo "$first * $second";
}
else($_POST['group1'] == divide) {
echo "$first / $second";
}
?>
</p> 
</body>
</html>
Comment

calculator in php

<head>
<meta charset="utf-8">
<title>Calculator</title>
</head>
<body>
<form method="post" attribute="post" action="disp_form.php">
<p>First Value:<br/>
<input type="text" id="first" name="first"></p>
<p>Second Value:<br/>
<input type="text" id="second" name="second"></p>
<input type="radio" name="group1" id="add" value="add" checked="true"><p>+</p><br/>
<input type="radio" name="group1" id="subtract" value="subtract"><p>-</p><br/>
<input type="radio" name="group1" id="times" value="times"><p>x</p><br/>
<input type="radio" name="group1" id="divide" value="divide"><p>/</p><br/>
<p></p>
<button type="submit" name="answer" id="answer" value="answer">Calculate</button>
</form>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Php :: show one value after point php 
Php :: get category of current post wordpress 
Php :: trait php 
Php :: upload images php mysql 
Php :: insert batch in laravel 
Php :: php str replace 
Php :: composer dump autoload laravel 
Php :: add a controller method in laravel routes 
Php :: php input time validation 
Php :: get user auth in laravel 
Php :: ternaire echo isset php 
Php :: create excel file using php] 
Php :: php null 
Php :: php validate colour 
Php :: add top menu bar in wordpress 
Php :: php apply function to array elements 
Php :: the uploaded file exceeds the upload_max_filesize directive in php.ini. wordpress 
Php :: if user name is wordpress 
Php :: get request header codeingiter3 
Php :: php add new item to associative array 
Php :: symfony messenger route 
Php :: find value in array php 
Php :: php get index of string 
Php :: php while jump to next loop 
Php :: php string to date 
Php :: laravel form validation based on another field value 
Php :: wordpress enqueue if shortcode 
Php :: merge array in php 
Php :: routes not defined 
Php :: laravel copy data 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =