Menu Village Hall Forms
 

Village Hall Forms

This page was accessed 3 September 2022. The page is no longer relevant so I have removed most of the links to the Village Hall site as its hosting has expired.

Since that time I have given-up on Wordpress forms that were created inside the Wordpress GUI. Initially the forms were constucted using an editor that has now been replaced by the Jetpack Block Editor.

The forms - developed NOT using Wordpress.

Reading and agreeing to terms and conditions

This is where I have to bring it all together.

My aim was to provide responsive forms (ones that can be completed easily on a mobile device), provide user feedback when the "submit" button is pressed, provide input validation and to send the appropriate emails to the responsible Committee members that are "in charge" of a particular event.

Top

Bookings and feedback could offer the option of an email response (auto-responder) or the user can print the response screen so that they have a record for their diaries and/or add that date to their calendars. It is not my intention to provide either an Events Calendar on the website or to offer to add the booking for the event to the users calendar.

Form Design and Flow

What I am trying to is present a form, validate the required fields and then display a response page and send emails to the appropriate recipients.

Update

My phylosophy has changed to have a single php file that displays a "submit" response and generates emails.

I still have to think whether I want an auto-responder. By that I mean when a user makes a booking there is an on-screen confirmation and an email gets sent to the appropriate VH member. If there is a case that the email is not a valid one and if an email is sent to the person making the booking then the user can save that email as a reminder.

I may be able to achieve what I orginally intended by using PHP Sessions

As I am not using cookies and not quite ready for a database, PHP Sessions may be a way to share data between pages.

Session variables solve this problem by storing user information to be used across multiple pages (e.g. username, favorite color, etc). By default, session variables last until the user closes the browser.

Adding Validation to forms

I maybe "beating myself up" on this but I want to get this to work by working it out. I could always take an example from somebody else, but I wouldn't learn anything.

The examples that I am using come from the W3C pages, as usual, not a complete solution as I mention above. The examples use the PHP_SELF variable to display the result on the same page.

I seem to be having problems with redirection - in fact it was more a question of being able to share data between pages. In normal circumstances the data is passed by the "action" of the form - either to a destiation page or the same page if there is validation being made on the page.

The PHP_SELF Variable

I am not sure if this s necassary for the validation to work ot whether it is more a question of security in reguard to "injection".

action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"

Setting and re-setting checkboxes

The GDPR checkbox resets in my forms. I haven't worked out how to maintain the "State Machine" - FIXED

What the W3C page says:

To show the values in the input fields after the user hits the submit button, we add a little PHP script inside the value attribute of the following input fields: name, email, and website. In the comment textarea field, we put the script between the <textarea> and </textarea> tags. The little script outputs the value of the $name, $email, $website, and $comment variables.

Then, we also need to show which radio button that was checked. For this, we must manipulate the checked attribute (not the value attribute for radio buttons):

Redundant forns

As develoment progress some of the forms I have upload need to be removed from the server and some renamed so that they can be idendified. I have named the php booking forms "booking_?????.php".

The Village Hall Forms

Links to the forms so that they can be tested:

  • The main booking form for hall rental
  • Movie Nights - There are some redundant forms on the server - movie_book
  • Race Night
  • Valentines dinner - this will be for 2021 if there is one
  • Bel-Fest
  • vhform_template.php - the template for future files and testing
  • Form Template explained - My code NOT Wordoress

2024

The website rears its head again!

The "Contact" form is back up

The booking forms are likely to follow!

Links

Top

References:

  • The exisiting Wordpress website - https:// belchampwaltervillagehall. wordpress.com/
  • Validate form email and URL - https://www.w3schools.com/php/php_form_url_email.asp
  • Using PHP_SELF in the action field of a form - http://form.guide/php-form/php-form-action-self.html
  • Input Checkbox checked Property - https:// www.w3schools.com/jsref/ prop_checkbox_checked.asp

Site design by Tempusfugit Web Design -