{"id":25222990,"url":"https://github.com/yemrehan/basic_web_form","last_synced_at":"2025-04-05T12:43:40.725Z","repository":{"id":247256637,"uuid":"823508549","full_name":"YEmrehan/basic_web_form","owner":"YEmrehan","description":"Basic Web Form is a beginner-friendly project that demonstrates how to create a simple HTML form and use PHP to retrieve and save submitted data into a text document. It’s ideal for learning form handling, data processing, and file storage with PHP. The project runs seamlessly on a local XAMPP server.","archived":false,"fork":false,"pushed_at":"2025-01-25T15:10:50.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T23:59:12.559Z","etag":null,"topics":["beginner-project","data-handling","file-storage","form-submission","html","php","server-side-scripting","web-forms","xampp"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YEmrehan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-03T07:05:49.000Z","updated_at":"2025-01-25T15:10:54.000Z","dependencies_parsed_at":"2024-07-07T17:43:27.747Z","dependency_job_id":"e762fd6b-9bc5-4e04-9779-cd2f1d6d57cb","html_url":"https://github.com/YEmrehan/basic_web_form","commit_stats":null,"previous_names":["yemrehan/basic_web_form"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YEmrehan%2Fbasic_web_form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YEmrehan%2Fbasic_web_form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YEmrehan%2Fbasic_web_form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YEmrehan%2Fbasic_web_form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YEmrehan","download_url":"https://codeload.github.com/YEmrehan/basic_web_form/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339122,"owners_count":20923009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner-project","data-handling","file-storage","form-submission","html","php","server-side-scripting","web-forms","xampp"],"created_at":"2025-02-10T23:59:15.064Z","updated_at":"2025-04-05T12:43:40.699Z","avatar_url":"https://github.com/YEmrehan.png","language":"HTML","readme":"# Basic Web Form: Retrieving Data to a Text Document\n\nThis project demonstrates how to create a simple web form using **HTML** and **PHP**, and retrieve the submitted data into a text document. It is a beginner-friendly solution ideal for understanding form handling and data storage with PHP.\n\n---\n\n## 🚀 Key Features\n\n- **User-Friendly Form:**\n  - A simple HTML form to collect user input (e.g., name, email, and message).\n\n- **Data Handling:**\n  - Retrieve and process form data using PHP.\n\n- **File Storage:**\n  - Save the submitted data to a text file for record-keeping.\n\n- **XAMPP Compatibility:**\n  - Runs seamlessly on a local XAMPP server.\n\n---\n\n## 🛠 Prerequisites\n\n1. Install **XAMPP** on your computer.\n2. Start the **Apache** server from the XAMPP control panel.\n3. Save the project files in the `htdocs` folder within the XAMPP installation directory.\n\n---\n\n## 🛠 Code Example\n\n### HTML Form\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eBasic Web Form\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch2\u003eSubmit Your Details\u003c/h2\u003e\n    \u003cform action=\"process.php\" method=\"POST\"\u003e\n        \u003clabel for=\"name\"\u003eName:\u003c/label\u003e\n        \u003cinput type=\"text\" id=\"name\" name=\"name\" required\u003e\u003cbr\u003e\u003cbr\u003e\n\n        \u003clabel for=\"email\"\u003eEmail:\u003c/label\u003e\n        \u003cinput type=\"email\" id=\"email\" name=\"email\" required\u003e\u003cbr\u003e\u003cbr\u003e\n\n        \u003clabel for=\"message\"\u003eMessage:\u003c/label\u003e\u003cbr\u003e\n        \u003ctextarea id=\"message\" name=\"message\" rows=\"5\" required\u003e\u003c/textarea\u003e\u003cbr\u003e\u003cbr\u003e\n\n        \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### PHP Script (process.php)\n```php\n\u003c?php\nif ($_SERVER[\"REQUEST_METHOD\"] === \"POST\") {\n    $name = htmlspecialchars($_POST['name']);\n    $email = htmlspecialchars($_POST['email']);\n    $message = htmlspecialchars($_POST['message']);\n\n    $data = \"Name: $name\\nEmail: $email\\nMessage: $message\\n---\\n\";\n\n    $file = 'submissions.txt';\n\n    if (file_put_contents($file, $data, FILE_APPEND)) {\n        echo \"\u003cp\u003eData saved successfully!\u003c/p\u003e\";\n    } else {\n        echo \"\u003cp\u003eFailed to save data.\u003c/p\u003e\";\n    }\n} else {\n    echo \"\u003cp\u003eInvalid request method.\u003c/p\u003e\";\n}\n?\u003e\n```\n\n---\n\n## 🌍 Use Cases\n\n- **Contact Forms:**\n  - Collect user queries or feedback on a website.\n\n- **Data Collection:**\n  - Gather information from users for surveys or registrations.\n\n- **Learning Project:**\n  - A great starting point for understanding PHP and HTML integration.\n\n---\n\n## 🛠 Future Enhancements\n\n- **Database Integration:**\n  - Store form data in a MySQL database instead of a text file.\n\n- **Validation \u0026 Security:**\n  - Add server-side validation and protection against SQL injection.\n\n- **Enhanced UI:**\n  - Use CSS or frameworks like Bootstrap to style the form.\n\n---\n\n## 🎯 Benefits\n\n- **Beginner-Friendly:** Simple structure makes it easy to understand and extend.\n- **Reusable:** The code can be adapted for various data collection needs.\n- **Practical Learning:** Demonstrates a real-world use case of web forms and PHP.\n\n---\n\n## 🌟 Conclusion\n\nThis project provides a fundamental understanding of creating and processing web forms with HTML and PHP. By saving data into a text file, it introduces essential concepts of server-side scripting and file handling.\n\n💡 **Start building web forms and collecting data today!**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyemrehan%2Fbasic_web_form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyemrehan%2Fbasic_web_form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyemrehan%2Fbasic_web_form/lists"}