page1.php - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of page1.php.php

  1.  
  2. <?php
  3. // page1.php
  4.  
  5. //session_start();
  6.  
  7. echo 'Welcome to page #1';
  8.  
  9. $_SESSION['favcolor'] = 'green';
  10. $_SESSION['animal']   = 'cat';
  11. $_SESSION['time']     = time();
  12.  
  13. // Works if session cookie was accepted
  14. echo '<br /><a href="page2.php"> page 2</a>';
  15.  
  16. echo '<BR> Colour : :'.$_SESSION['favcolor']; // green
  17. echo '<BR> Animal : :'.$_SESSION['animal'];   // cat
  18. echo '<BR> Time   : :'.date('Y m d H:i:s', $_SESSION['time']);
  19.  
  20. echo '<br /><a href="page1.php?">page 1</a>';
  21. ?>
  22.  
  23.  
File Description
  • page1.php
  • PHP Code
  • 10 Feb-2020
  • 475 Bytes
You can Share it: