Menu

[solved]-Use Page1php Page2 Page3 Examples Chapter 23 Template Create Fourth Fifth Page Participati Q38998729

Use the page1.php and page2, page3 examples in chapter 23 astemplate. Create a fourth and fifth page participating the session.On each page, show links to all the other pages (it is OK toinclude a link to the current page). You may copy these files frommy directory: ~etest/public_html/Chapter23/ On each page, display alist of all pages you visited during this session as shown below.-You may use the Superglobal variable $_SERVER[“PHP_SELF”] toaccess the name of the current page. -To declare an empty array usesyntax: $some_array = []; -To append to this array: $some_array[] =‘Appended string’; – you may use foreach() to retrieve the contentof the session array -Hint: save an array of strings of page namesto session variable, e.g. $_SESSION[‘pagenames’]=$some_array; Or$_SESSION[‘pagenames’][]= $_SERVER[‘PHP_SELF’];

codes for pages 1-3

Page1:

<?php
session_start();
echo “Page 1 <br />”;
$_SESSION[‘name’]= “Bob”;
$_SESSION[‘address’]= “2801 Bancroft”;
//print_r($_SESSION);
echo $_SESSION[‘name’],”<br>”;
echo $_SESSION[‘address’],”<br>”;
echo $_SESSION[‘phone’];
?>
<br/>
<a href=”page1.php”>Page 1</a>
<a href=”page2.php”>Page 2</a>
<a href=”page3.php”>Page 3</a>
<a href=”page4.php”>Page 4</a>
<a href=”page5.php”>Page 5</a>

Page 2:

<?php
session_start();
echo “page 2<br />”;
echo $_SESSION[‘name’],”<br>”;
echo $_SESSION[‘address’];
$_SESSION[‘phone’]= “333-333-3333”;

?>
<br/>
<a href=”page1.php”>Page 1</a>
<a href=”page2.php”>Page 2</a>
<a href=”page3.php”>Page 3</a>

Page 3:

<?php
echo “page 3 <br />”;
session_start();
echo $_SESSION[‘name’],”<br />”;
echo $_SESSION[‘address’];

session_destroy();

?>
<br/>
<a href=”page1.php”>Page 1</a>
<a href=”page2.php”>Page 2</a>
<a href=”page3.php”>Page 3</a>

Expert Answer


Answer to Use the page1.php and page2, page3 examples in chapter 23 as template. Create a fourth and fifth page participating the … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *