Php Code Given Exercise 2 Exercise 2 First Form Favourite Colour Php Code Given Exercise 2 Q43810092(1)

PHP code given for exercise-2 :
<?php
// Write the code to destroy the session here
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<title>Exercise 2</title>
</head>
<body>
<h1>First Form</h1>
<form action=”exercise-2a.php” method=”POST”>
<label for=”fav-colour”>Favourite Colour:</label><input type=”text” name=”favColour”id=”fav-colour”>
<input type=”submit” name=”submit” value=”Submit”>
</form>
</body>
</html>
PHP code given for exercise-2a:
<?php
// Write the code to check if the first form has been submitted,and then
// store the data within a session variable
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<title>Exercise 2a</title>
</head>
<body>
<h1>Second Form</h1>
<form action=”exercise-2b.php” method=”POST”>
<label for=”fav-colour”>Favourite Colour:</label><input type=”text” name=”favColour”id=”fav-colour”>
<input type=”submit” name=”submit” value=”Submit”>
</form>
</body>
</html>
PHP code given for exercise-2b:
<?php
// Write the code to redirect to exercise-2.php if first form datais not part of session.
// Then write the code to get the session data from first form andthen POST data from second
// form
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<title>Exercise 2a</title>
</head>
<body>
<h1>Results</h1>
<h2>Session Data</h2>
<p><!– Echo your session data from form onehere–></p>
<hr>
<h2>POST Data</h2>
<p><!– Echo your POST data from form two here–></p>
</body>
</html>
You have been given the files exercise-2.php, exercise-2a.php and exercise-2b.php. Two of these files contain a HTML form with a single input textbox field and submit button. Your task is to save the data entered to a session variable, then progress to exercise-2a.php, allow the user to enter in more data and then echo that data on exercise-2b.php For the first form, data sent via the POST method must be saved within a session variable. For the second form, the data is not to be saved within session and retrieved only from the POST variable in exercise- 2b.php. If the user arrives at exercise-2b.php without the session variable holding data the user is sent back to exercise-2.php and the session is destroyed and the process starts again. The sequence of actions is: exercise-2.php submits to exercise-2a.php, and exercise-2a.php submits to exercise-2b.php. exercise-2b.php displays the session data from exercise-2.php and the form (POST) data from exercise-2a.php. Show transcribed image text You have been given the files exercise-2.php, exercise-2a.php and exercise-2b.php. Two of these files contain a HTML form with a single input textbox field and submit button. Your task is to save the data entered to a session variable, then progress to exercise-2a.php, allow the user to enter in more data and then echo that data on exercise-2b.php For the first form, data sent via the POST method must be saved within a session variable. For the second form, the data is not to be saved within session and retrieved only from the POST variable in exercise- 2b.php. If the user arrives at exercise-2b.php without the session variable holding data the user is sent back to exercise-2.php and the session is destroyed and the process starts again. The sequence of actions is: exercise-2.php submits to exercise-2a.php, and exercise-2a.php submits to exercise-2b.php. exercise-2b.php displays the session data from exercise-2.php and the form (POST) data from exercise-2a.php.
Expert Answer
Answer to PHP code given for exercise-2 : Exercise 2 First Form Favourite Colour: PHP code given for exercise-2a: Exercise 2a Seco…
OR