PHP Programming Basics Practice Test: HTML Forms & PHP — Flashcards | PHP & Programming | FatSkills

PHP Programming Basics Practice Test: HTML Forms & PHP — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

HTML forms are used to send user information to a server, which then returns the results to the browser. The main difference between an HTML form and a PHP form is that a PHP file can contain PHP code, while an HTML file can only contain HTML. This means that you can put PHP code within your HTML markup, but the PHP code won't be executed. PHP can be used for dynamic generation and accessing server-side data. 

Here are some ways to use PHP with HTML forms:
Send data to the server:
You can use PHP scripting to send data from HTML forms directly to the server. There are two methods for sending data to the server: GET and POST. The GET method sends data through the browser's URL, which can be seen by anyone using the browser. The POST method is safer for sending confidential data.
Validate form data: You can use PHP to validate form data. For example, you can use text fields for the user's name, address, and email address, radio buttons to store how much fruit the user eats per day, or a select list to store the user's favorite fruit. If the form fails validation, the user will see an error message next to any empty fields. 

Here's an example of an HTML form:
<form action=action.php'' method=post''>
<label for=``name''>Your name:</label>
<input name=name'' id=name You should use the POST method when you're using the form to change the state of something on the server end. 

1 of 10 Ready
Which two predefined variables are used to retrieve information from forms?
$_GET & $_SET
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password