I have just begun to learn HTML about a month ago. My objective is to create a site that any visiter may post onto. (Kinda like the site you are on now just a lot simpler). In other words, the person would type stuff in a box, and press submit. Then whatever they wrote would become part of the site.

Preferably, it would become part of a seperate site that users could not access so that i mat preview the post first. But if that's not possible, it's OK.

If this doesn't work, i could just have people email me, but that just wouldn't be nifty!

Dani AI

Generated

As observed, plain HTML (or client-side JavaScript alone) cannot accept and persist visitor submissions — a server-side component is required to receive POST data and store it. 's pointer toward third‑party tools is a valid shortcut for getting a working posting feature without building the backend. A compact, maintainable architecture is: an HTML form → server handler (PHP/Node/etc.) → storage (database or file) → moderation queue (optional) → public display.

A minimal, practical PHP pattern (illustrative only) is to accept the POST, insert into a posts table with a status column set to pending, and show only rows with status = 'approved'. Important: always use parameterized queries and escape on output.

<?php
// store.php (illustration)
$pdo = new PDO('mysql:host=localhost;dbname=mydb;charset=utf8mb4','dbuser','dbpass',[
  PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION
]);
$title = trim($_POST['title'] ?? '');
$body  = trim($_POST['body']  ?? '');
if ($body !== '') {
  $stmt = $pdo->prepare('INSERT INTO posts (title,body,status,created_at) VALUES (?,?,?,NOW())');
  $stmt->execute([$title,$body,'pending']);
}

When displaying, escape and preserve simple formatting:

echo '<h2>'.htmlspecialchars($row['title']).'</h2>';
echo '<div>'.nl2br(htmlspecialchars($row['body'])).'</div>';

Notes and cautions: a flat JSON/file approach can work for prototypes but needs file locking and backups. Key security controls are input validation, prepared statements (no string interpolation into SQL), output escaping (htmlspecialchars), CSRF protection on forms, HTTPS, and spam/rate limits (CAPTCHA or throttling). For moderation, store status and build an admin page to approve/reject so posts remain invisible until reviewed. For a quicker path, a hosted form-handler or a lightweight CMS/forum engine provides posting, moderation and spam protection out of the box. Start with a local dev setup, test the approval workflow, then harden input/output handling before going live.

Recommended Answers

All 2 Replies

You cannot do this with HTML alone. Or even, for that matter, JavaScript, which is a language to manipulate things (the web document, the browser, cookies) on the client. You'll need to learn at least a server-side language (may I suggest "PHP"), and likely a database and SQL.

Looks like you are going to creat content management system (CMS) or support ticket for your site. PHP as tgreer suggested is a best directon to start with. If you prefer to keep everything simple, you can use third party program, try www.bravenet.com for some free stuffs.
.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.