{"id":5961,"date":"2024-09-20T09:53:00","date_gmt":"2024-09-20T08:53:00","guid":{"rendered":"https:\/\/harmonweb.com\/blog\/?p=5961"},"modified":"2024-09-18T06:11:57","modified_gmt":"2024-09-18T05:11:57","slug":"setting-up-a-simple-html-form-for-user-comments","status":"publish","type":"post","link":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/","title":{"rendered":"Setting Up a Simple HTML Form for User Comments"},"content":{"rendered":"\n<p>In this tutorial, I will guide you through the process of setting up a simple HTML form for user comments.<\/p>\n\n\n\n<p>We will be working with a MySQL Database using PHP on cPanel, creating a simple two-page website where users can post comments on either page and view all posted comments.<\/p>\n\n\n\n<p>Let&#8217;s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Quick Introduction to HTML Forms<\/h2>\n\n\n\n<p>Using HTML forms, users of your website can input different data into your website. This data will be submitted to another page for processing. An HTML form can collect a user&#8217;s comment or information, and add the submitted comments to your database for review.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gathering the Form Data<\/h2>\n\n\n\n<p>HTML forms can handle various types of input. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Text boxes<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Radio buttons<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check boxes etc.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Submitting the Form Data<\/h2>\n\n\n\n<p>When the user completes filling the required data in the HTML form and clicks the submit button included in the form, their data is sent for processing. The submitted data can be processed on that same page or sent to a different script to add to your database.<\/p>\n\n\n\n<p>The data is transmitted using either the GET or POST method. With GET, the data is appended to the URL, like so:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET domain.com\/page.php?name=Daniel&amp;email=daniel@domain.com<\/code><\/pre>\n\n\n\n<p>Here, the name and email are visible in the URL. Conversely, with POST, the URL remains clean:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST domain.com\/page.php<\/code><\/pre>\n\n\n\n<p>&#8230;and the name and email are sent behind the scenes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Our Example Contact Form<\/h2>\n\n\n\n<p>For our comments form, we&#8217;ll primarily use text boxes for input. Below is an example of what our contact form will look like:<\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Comment Form<\/title>\n<\/head>\n<body>\n    <h2>Leave a Comment<\/h2>\n    <form action=\"process_comment.php\" method=\"post\">\n        <label for=\"name\">Name:<\/label><br>\n        <input type=\"text\" id=\"name\" name=\"name\" required><br><br>\n\n        <label for=\"email\">Email:<\/label><br>\n        <input type=\"email\" id=\"email\" name=\"email\" required><br><br>\n\n        <label for=\"comment\">Comment:<\/label><br>\n        <textarea id=\"comment\" name=\"comment\" rows=\"4\" cols=\"50\" required><\/textarea><br><br>\n\n        <input type=\"submit\" value=\"Submit\">\n    <\/form>\n<\/body>\n<\/html>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I will guide you through the process of setting up a simple HTML form for&hellip;<\/p>\n","protected":false},"author":1,"featured_media":5963,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[157],"tags":[],"class_list":["post-5961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-client"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, I will guide you through the process of setting up a simple HTML form for&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/\" \/>\n<meta property=\"og:site_name\" content=\"HarmonWeb Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-20T08:53:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Adegoke\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Adegoke\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/\"},\"author\":{\"name\":\"John Adegoke\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/e9bc75c3e7e30a261690c47ec872a8fc\"},\"headline\":\"Setting Up a Simple HTML Form for User Comments\",\"datePublished\":\"2024-09-20T08:53:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/\"},\"wordCount\":272,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Simple-HTML-form_20240918_060849_0000.png\",\"articleSection\":[\"Client\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/\",\"name\":\"Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Simple-HTML-form_20240918_060849_0000.png\",\"datePublished\":\"2024-09-20T08:53:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#primaryimage\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Simple-HTML-form_20240918_060849_0000.png\",\"contentUrl\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Simple-HTML-form_20240918_060849_0000.png\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/setting-up-a-simple-html-form-for-user-comments\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting Up a Simple HTML Form for User Comments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/\",\"name\":\"HarmonWeb Blog\",\"description\":\"HarmonWeb\",\"publisher\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#organization\",\"name\":\"HarmonWeb\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/cropped-HARMON-WEB-LOGO-2.png\",\"contentUrl\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/cropped-HARMON-WEB-LOGO-2.png\",\"width\":831,\"height\":172,\"caption\":\"HarmonWeb\"},\"image\":{\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/e9bc75c3e7e30a261690c47ec872a8fc\",\"name\":\"John Adegoke\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058\",\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058\",\"contentUrl\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058\",\"caption\":\"John Adegoke\"},\"sameAs\":[\"https:\\\/\\\/harmonweb.com\\\/blog\"],\"url\":\"https:\\\/\\\/harmonweb.com\\\/blog\\\/author\\\/harmonweb\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/","og_locale":"en_US","og_type":"article","og_title":"Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog","og_description":"In this tutorial, I will guide you through the process of setting up a simple HTML form for&hellip;","og_url":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/","og_site_name":"HarmonWeb Blog","article_published_time":"2024-09-20T08:53:00+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png","type":"image\/png"}],"author":"John Adegoke","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Adegoke","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#article","isPartOf":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/"},"author":{"name":"John Adegoke","@id":"https:\/\/harmonweb.com\/blog\/#\/schema\/person\/e9bc75c3e7e30a261690c47ec872a8fc"},"headline":"Setting Up a Simple HTML Form for User Comments","datePublished":"2024-09-20T08:53:00+00:00","mainEntityOfPage":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/"},"wordCount":272,"commentCount":0,"publisher":{"@id":"https:\/\/harmonweb.com\/blog\/#organization"},"image":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#primaryimage"},"thumbnailUrl":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png","articleSection":["Client"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/","url":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/","name":"Setting Up a Simple HTML Form for User Comments | HarmonWeb Blog","isPartOf":{"@id":"https:\/\/harmonweb.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#primaryimage"},"image":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#primaryimage"},"thumbnailUrl":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png","datePublished":"2024-09-20T08:53:00+00:00","breadcrumb":{"@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#primaryimage","url":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png","contentUrl":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2024\/09\/Simple-HTML-form_20240918_060849_0000.png","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/harmonweb.com\/blog\/setting-up-a-simple-html-form-for-user-comments\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/harmonweb.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Setting Up a Simple HTML Form for User Comments"}]},{"@type":"WebSite","@id":"https:\/\/harmonweb.com\/blog\/#website","url":"https:\/\/harmonweb.com\/blog\/","name":"HarmonWeb Blog","description":"HarmonWeb","publisher":{"@id":"https:\/\/harmonweb.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/harmonweb.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/harmonweb.com\/blog\/#organization","name":"HarmonWeb","url":"https:\/\/harmonweb.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/harmonweb.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2020\/06\/cropped-HARMON-WEB-LOGO-2.png","contentUrl":"https:\/\/harmonweb.com\/blog\/wp-content\/uploads\/2020\/06\/cropped-HARMON-WEB-LOGO-2.png","width":831,"height":172,"caption":"HarmonWeb"},"image":{"@id":"https:\/\/harmonweb.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/harmonweb.com\/blog\/#\/schema\/person\/e9bc75c3e7e30a261690c47ec872a8fc","name":"John Adegoke","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/harmonweb.com\/blog\/wp-content\/litespeed\/avatar\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058","url":"https:\/\/harmonweb.com\/blog\/wp-content\/litespeed\/avatar\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058","contentUrl":"https:\/\/harmonweb.com\/blog\/wp-content\/litespeed\/avatar\/0843e926db683e41ace2aee54210b841.jpg?ver=1775630058","caption":"John Adegoke"},"sameAs":["https:\/\/harmonweb.com\/blog"],"url":"https:\/\/harmonweb.com\/blog\/author\/harmonweb\/"}]}},"_links":{"self":[{"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/posts\/5961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/comments?post=5961"}],"version-history":[{"count":1,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/posts\/5961\/revisions"}],"predecessor-version":[{"id":5962,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/posts\/5961\/revisions\/5962"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/media\/5963"}],"wp:attachment":[{"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/media?parent=5961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/categories?post=5961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/harmonweb.com\/blog\/wp-json\/wp\/v2\/tags?post=5961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}