Create a document with a form that registers all nonprofit o
Create a document with a form that registers all non-profit organizations in the area, the number of members they have, and the type of organization. After the user enters data in all the fields and presses the button, your program will create a single text le that saves information for each organization on a separate line. The name of the data file is np.txt. This data file should be created in the same directory as your running program, without hard-coding the file path to ensure portability.
In the data file please include the Organization name, Membership, and Type, separated by commas. Membership should only accept numbers, Type should only accept the following strings: Educational, Animal Rescue, Religious, Food Service, and misspellings should not be allowed. The first line of the output will be the headers. You can make up all the names and numbers while you are testing your programs.
Sample Output written to a file will look as following:
Organization, Membership, Type
Meals on Trucks, 123, Food Service
The Church of Purple Cross, 34, Religious
Kitties and Puppies, 1234, Animal Rescue
etc.
Submit your form file named \"np.html\", and your handler file named \"np.php\".
Solution
np.html
<html>
<head>
<title>Registration form</title>
</head>
<body>
<h3>Registration form:</h3>
<form action=\"np.php\" method=\'post\'>
Organization name: <input type=\'text\' name=\"name\" value=\'\' required><br>
Membership: <input type=\'number\'name=\"membership\" value=\'\' required><br>
Type:<input type=\"radio\" name=\"Type\" value=\"Educational\" > Educational<br>
<input type=\"radio\" name=\"Type\" value=\"Animal Rescue\"> Animal Rescue<br>
<input type=\"radio\" name=\"Type\" value=\"Religious\">Religious<br>
<input type=\"radio\" name=\"Type\" value=\"Food Service\">Food Service<br>
<input type=\'submit\' value=\'Submit\'>
</form>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------
np.php
<?php
// Open the text file
$f = fopen(\"np.txt\", \"w\");
// Write text
fwrite($f, $_POST[\"name\"]); fwrite($f,\",\");
fwrite($f, $_POST[\"membership\"]);fwrite($f,\",\");
fwrite($f, $_POST[\"type\"]);
fclose($f);
?>

