Notes on web development, self-hosting, and troubleshooting.
An error message is easier to act on when the form still contains what you typed. You can test that with a small local PHP form containing an email field and a message field.
On submit, validate the email and check that the message is present. If either check fails, … Continue reading →
A shared stylesheet becomes more interesting when you try swapping it out altogether. Make a short HTML page with a heading, a navigation list, and an article. Keep a copy of the markup and use it for both versions of the design.
In the first stylesheet, put the links on … Continue reading →
A comment section can make a blog feel like a conversation. It also creates a decision about what happens between someone clicking Submit and their words appearing on the page.
Use a local test blog to try two paths. Submit a comment as a new visitor and check whether it … Continue reading →
The first time you change a site’s address structure, it’s tempting to judge the result by the new menu. An old link from somebody’s blog or feed is a better test. That link still points to the address you published originally.
Make a tiny URL inventory before changing a local … Continue reading →
An upgrade is easier to think through when you know what you would restore if the site stopped working. With a WordPress blog, that means keeping both the database and the files. Posts and settings live in the database. The files include your uploads, themes, plugins, and configuration.
Try a … Continue reading →
A site with several hand-written pages can use a little help keeping its index up to date. This Python exercise takes the HTML filenames in a folder and prints a basic list. It’s written for modern Python so you can run it today while recreating the kind of housekeeping script … Continue reading →
A small site can look like a folder of files right up until you have to move it. Once it uses PHP and a database, the files are only part of what needs to travel.
Try a practice move between two local environments. Copy the site files, export the database, … Continue reading →
A folder of HTML pages is easy to browse until you want to show the most recent five entries automatically. A database can answer that question without you updating the index every time you add a page.
In a local database, make a sample posts table with an integer id, … Continue reading →
A form can look right in the browser and still send the wrong fields to the server. Start by tracing one value all the way from its input to the PHP code that receives it.
On a local PHP site, make a form with method="post" and one input with name="display_name". … Continue reading →
A small example can explain the idea behind early Ajax interfaces. Click a button, request a text file, and place the answer into one part of the page. The rest of the page stays where it is.
Give the page a button with ID load and a paragraph with ID … Continue reading →