I need help on figuring out how to get the isset() function to work

Viewed 24

Create a new PHP file called lab2.php. Inside, add the HTML skeleton code and give its title “Lab Week 2”. Create a form asking for the person’s name and favourite ice cream flavour. Store the data using variables. Use the isset function to check. Print the results.

PHP CODE HTML CODE

1 Answers

You should use POST request for sending data from user(.html file) to server(.php file).

In your HTML file, comment this

//<form action="lab2.php" method="get">

and use this

<form action="lab2.php" method="post">

In yout PHP file, you can get data using

if(isset($_POST['icecream'])) {
  echo $_POST['icecream']
}
Related