



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Forms are the basic interface between user and server. Form handling is the basic and important feature of PHP.
Example :
2.Form Elements :
,radio buttons and text areas.
3.PHP Script :
● In the form php file process the form data submitted by the user. We can access the
➢ The array name is declared to handle multiple selection options and each
➢ The values selected are submitted as an array when the form is processed and the backend ,such as in php,can access and handle these selected groups.
Form Data Submitted:"; echo "Name: ". $name. "
"; echo "Gender: ". $gender. "
";
if(!empty($_POST['skills'])) { echo "Skills: "; foreach($_POST['skills'] as $skill) { echo $skill. " "; } echo "
"; }
echo "Comments: ". $comments; } ?>
📝Program Explanation :
★ The text field is used to enter the user’s name.
★ Radio buttons allow the user to select only one option (gender).
★ Checkboxes allow the user to select multiple skills.
★ The text area is used to enter comments or feedback.
★ When the submit button is clicked, the form data is sent using the POST method and processed by PHP.
Name: Harini
Gender: Female Skills: PHP HTML Comments: This is my first PHP form program.
🧾Output Explanation :
★ The entered name is displayed.
★ The selected gender is shown.
★ All selected skills from checkboxes are printed.
★ The text entered in the comments field is displayed.
★ Output is generated only after clicking the Submit button.