Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<h1>Find the Greatest Number</h1>
<form action="greatest_number.php" method="POST">
<label for="num1">Enter 1st number:</label>
<input type="number" name="num1" id="num1" required>
<label for="num2">Enter 2nd number:</label>
<input type="number" name="num2" id="num2" required>
<input type="submit" value="Find Greatest">
</form>
<?php
// Set a custom session save path (use /tmp for online compilers)
session_save_path("/tmp");
session_start(); // Start the session
// Store session variables
$_SESSION["favanimal"] = "Cat";
$_SESSION["favcolor"] = "Yellow";
echo "Session is set.<br>";
echo "<p>Nobita's favourite color is: " . $_SESSION["favcolor"] . "</p>";
echo "<p>Nobita's favourite animal is: " . $_SESSION["favanimal"] . "</p>";
?>