I'm learning PHP and I'm having trouble with printing results of two numbers, when I put two numbers in cells it should pop up next cell with result, but it's not working and I've not idea what I've wrong. Also I'm getting one error on line 30. Thank you for any tip/help.
<!DOCTYPE html>
<html>
<head>
<title>Addition of two numbers</title>
<link rel="stylesheet" type="text/css" href="blah.css">
</head>
<body>
<center>
<center title="text">
<h1><strong id="element">Addition of two numbers</strong></h1><br><br>
</center>
<form action="index.php" method="POST">
<input type="text" name="c1" class="textInput" placeholder="Enter first number"/><br><br>
<input type="text" name="c2" class="textInput" placeholder="Enter second number"/><br><br>
<p class="button">
<input type="submit" value="MAGIC !" name="calculate"/>
</p>
</form>
</center>
<?php
if(isset($_POST["c1" && "c2"])){
$c1 = $_POST['c1'];
$c2 = $_POST['c2'];
echo "<br><center><input type=\"text\" id=\"\" style=\"text-align:center\"/>".($c1+$c2)."</center>";
}
if(is_empty($_POST["c1" || "c2"])){
echo "Please fill the cells";
}
else{
echo "<font color=\"red\" size=\"20\">"RARE FATAL ERROR"</font>"; /* 34 null unexpected 'RARE' (T_STRING), expecting ',' or ';' */
}
?>
</body>
</html>

New Topic/Question
Reply



MultiQuote





|