Round-trip Scripts
One design strategy that you’ll see throughout this book is scripts that are used to generate a form and process that same form. Rather than creating an HTML page with a form on it, and then having that form submitted to a script, it’s often easier to write a single script that detects whether a form was submitted, generates the form if it was not submitted, or processes the form if it was. This approach is particularly useful if the script performs any validation on the user’s input, because in these cases, the script will probably have to include code that generates the form in the first place.
Because scripts that process form input are the core of nearly every Web application, it makes sense to spend time on how this approach ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access