Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Complete Application - meeting room quotation
Complete example - Registering for a get-together example from a Well House Consultants training course
More on Complete example - Registering for a get-together [link]

If you're searching for a page where you can try this code, select here

This example references the following resources:

Source code: qmeet.php Module: H203


# Quotation for hosting a meeting (or an event)

# "Classic" PHP example ...

# First, define values that may change later all in one place

$roombase["Berks"] = array("m" => 60 "a" => 60 "e" => 60 ,
"ma" => 90 "ae" => 90 "mae" =>  90) ;
$roombase["Wilts"] = array("m" => 120 "a" => 120 "e" => 80 ,
"ma" => 190 "ae" => 190 "mae" =>  190) ;
$roombase["both"] = array("m" => 150 "a" => 150 "e" => 100 ,
"ma" => 235 "ae" => 235 "mae" =>  235) ;

$roomnames = array("Berks" => "The Berks""Wilts"
=> "The Wilts""both" => "The Wilts AND The Berks");
$todnames = array("m" => "morning""a" => "afternoon",
"e" => "evening");

$standard_occupancy = array("Berks" => 5"Wilts" => 10,
"both" => 12);

$prpn 72# 70 pounds per room per night
$simplefood 8# lunch - per head
$extendedfood 10# lunch - per head
$bufferfood 14# lunch - per head
$fulldel 8# Full day delegate rate (over the included base)
$halfdel 5# Half day delegate rate over the basic
$maxpeep 30# Maximum people (minimum is 2 for a meeting!)
$maxberks 7# Maximum for smaller room

# Then define any functions that are needed

function priceit($formit) {
        return (

# Define the menu's parameters

$peeper = array("How many people","npeeps","-----|Please Choose");
for (
$k=2$k<=$maxpeep$k++) { array_push($peeper,"$k|$k"); }
$selector = array( $peeper,
"Which Rooms?" "confrooms",
"-----|Please Select",
"Wilts|Larger room (Wilts / recommended for 6 or more)",
"Berks|Smaller room (Berks / recommended for up to 5)"),
"for which part of the day?","daypart",
"-----|Please Select",
"ma|Morning and afternoon",
"ae|Afternoon and evening",
"mae|Morning, afternoon and evening"),
"lunch option","meal",
"-----|Please Select",
"overnight rooms","nbeds",
"0|No-one staying",
"1|1 room",
"2|2 rooms",
"3|3 rooms",
"4|4 rooms",
"5|5 rooms"),
"No. of nights","nnights",
"0|Not staying",
"1|1 night",
"2|2 nights"));

# Create the menu, including sticky fields
# Also a hidden field so we knwo when it's filled in

$form "<table><form method=POST>";
$form .= "<input type=hidden name=filled value=42>";
foreach (
$selector as $sel) {
$form .= "<tr><td>$sel[0]</td>";
$form .= "<td><select name=$sel[1]>";
        for (
$o=2$o<count($sel); $o++) {
$val,$txt) = explode("|",$sel[$o]);
$now = ($_REQUEST[$sel[1]] == $val) ? " SELECTED":"";
$form .= "<option value=$val$now>$txt</option>";
$form .= "</td></tr>";
$form .= "<tr><td>&nbsp;</td><td><input type=submit></td></tr>";
$form .= "</form></table>";

$errlog "";

# If the form has been filled in, validate it

if ($_REQUEST[filled] != 42) {
$status "Results appear here when form submitted<br>";
$errorlog "";
} else {

# Single field validators

if (ereg("^-",$_REQUEST[confrooms])) {
$errlog .= "You must choose a room\n";}
        if (
$_REQUEST[npeeps] < or $_REQUEST[npeeps] > $maxpeep) {
$errlog .= "You must select the number of people\n";}
        if (
ereg("^-",$_REQUEST[daypart])) {
$errlog .= "You must specify which part of the day\n";}

# More complex validators

if (ereg("^-",$_REQUEST[meal]) and ereg("[ma]",$_REQUEST[daypart])) {
$errlog .= "Daytime meeting - do you want lunch?\n";}
        if (
ereg("[seb]",$_REQUEST[meal]) and ! ereg("[ma]",$_REQUEST[daypart])) {
$errlog .= "Evening meeting - we cannot serve you lunch\n";}
        if (
$_REQUEST[npeeps] > $maxberks and $_REQUEST[confrooms] == "Berks") {
$errlog .= "Sorry - too many people for that room (max $maxberks)\n"; }
        if (
$_REQUEST[nbeds] > $_REQUEST[npeeps] and $_REQUEST[npeeps] >= 1) {
$errlog .= "Number of bedrooms exceeds number at meeting\n"; }
        if (
$_REQUEST[nbeds] == and $_REQUEST[nnights] != 0) {
$errlog .= "Number of nights specified, but zero rooms\n"; }
        if (
$_REQUEST[nbeds] != and $_REQUEST[nnights] == 0) {
$errlog .= "Number of rooms specified, but zero nights\n"; }

# Make up error message or do the calculation

if ($errlog) {
$status .= "Please correct these errors:<br>";
$status .= "<font color=red>".nl2br($errlog)."</font>";
        } else {

$bedpricing $prpn $_REQUEST[nbeds] * $_REQUEST[nnights];
$bedstate "No overnight accommodation";
                if (
$bedpricing) {
$bedstate "$_REQUEST[nbeds] bedrooms for ";
$bedstate .= "$_REQUEST[nnights] nights";

$lunchpricing 0;
$lunchstate "No lunch to be provided";
                if (! 
ereg("[ma]",$_REQUEST[daypart])) {
$lunchstate "evening meeting - lunch not applicable";
                if (
$_REQUEST[meal] == "s") {
$lunchpricing $simplefood $_REQUEST[npeeps];
$lunchstate "Simple lunch for $_REQUEST[npeeps]";
                if (
$_REQUEST[meal] == "e") {
$lunchpricing $extendedfood $_REQUEST[npeeps];
$lunchstate "Extended lunch for $_REQUEST[npeeps]";
                if (
$_REQUEST[meal] == "b") {
$lunchpricing $buffetfood $_REQUEST[npeeps];
$lunchstate "Buffet lunch for $_REQUEST[npeeps]";

$roompricing =
$roomstate $roomnames[$_REQUEST[confrooms]]. " for the ";
$podd = array();
                foreach (
preg_split("//",$_REQUEST[daypart]) as $letr) {
                        if (
$todnames[$letr]) {
$roomstate .= implode(" and ",$podd);

$overspill =
$_REQUEST[npeeps] - $standard_occupancy[$_REQUEST[confrooms]];
                if (
$overspill 1) { $overspill 0;
$coffeepricing 0;
$coffeestate "Delegate pack included in price";
                } else {
$coffeestate "Delegate pack for ".
" included. For $overspill extra add";
$coffeepricing $overspill $fulldel;
                        if (
strlen($_REQUEST[daypart]) < 2) {
$coffeepricing $overspill $halfdel;
$tq $roompricing $coffeepricing $lunchpricing +
$bedpricing ;

$status "<table cellpadding=5 cellspacing=5>";
$status .= "<tr><td>$roomstate</td><td align=right>".
$status .= "<tr><td>$coffeestate</td><td align=right>".
priceit($coffeepricing) . "</td></tr>";
$status .= "<tr><td>$lunchstate</td><td align=right>".
priceit($lunchpricing) . "</td></tr>";
$status .= "<tr><td>$bedstate</td><td align=right>".
priceit($bedpricing) . "</td></tr>";
$status .= "<tr><td><b>Total including VAT</b></td><td align=right><b>".
priceit($tq) . "</b></td></tr>";
$status .= "<tr><td colspan=2><hr></td></tr>";
$status .= "<tr><td>25% deposit would be</td><td align=right>".
priceit($tq 0.25) . "</td></tr>";
$status .= "<tr><td colspan=2><hr></td></tr>";
$status .= "<tr><td colspan=2>Quote prepared on ".date("jS F Y").
" and valid for booking for 30 days".
"<br>for event to run at any future dates subject to availability".
$status .= "</table>";

<title>Meeting / training room quotation</title>
<table width=100%><tr><td align=middle>
<h2>Meeting and training room quotation</h2>
<a href=http://www.wellhousemanr.couk>Well House Manor</a>, 48 Spa Road, Melksham, SN12 7NY<br />
+44 (0) 1225 708225 &bull; info@wellho.net
</td><td align=right><img width=150 src=http://www.wellhousemanor.co.uk/images/WHMlogo.gif></td></tr></table>
<?= $status ?><br>
<?= $form ?><br>
Please note that our facilities are suitable for business meetings,
interviews, presentations and training courses. Prices quoted
include teas / coffees on arrival for all delegates and at intervals
throughout the event, biscuits, pastries, cakes (home baked) etc,
as appropriate.  Price quoted also
includes use of internet, whiteboard, overhead and laptop projector,
but please let us know ahead of time if you'll want to make use of them.<br /><br />
<b>Lunch Options</b> included in our quotation system:<br />
&nbsp;&bull;&nbsp;Simple - Baguettes, fruit salad, beveraged<br />
&nbsp;&bull;&nbsp;Extended - Baguettes / sandwiches / crisps / snacks / salad.  Fruit salad and cakes<br />
&nbsp;&bull;&nbsp;Buffet - As above, plus a selection of savoury finger food e.g. Quiche, Scotch eggs.<br />
We can cater for most specific dietary requirements if notified in good time<br />
Further food options available on request - please email or all to discuss what you need.
<br /><br />
Quotations presented on this page are for single day bookings and are
subject to our standard terms and conditions - see
<a href=http://www.wellho.net/share/eventterms.html>[here]</a>. A 25%
deposit is required to confirm a booking, with the balance due at the
time of the event.  We are are happy to extent credit to well established
organizations placing official orders, subject to our sole discretion. <br /><br />
Bookings for multiple day events attract at 20% discount <b>off the
room hire rate</b> for the second and subsequent sequential day in a
series, or a 10% discount <b>off the room hire rate</b> if the
subsequent days do not immediately follow on from the first day.
Hires for both rooms attract a 10% discount <b>off the room hire
rate</b> for both rooms.<br /><br />
We can offer better prices for bulk / block bookings made significantly
in advance, and those prices can be bettered again if the booking are
paid for at the time of booking and are nonrefundable in the event of
change or cancellation.

Learn about this subject
This module and example are covered on our public Beginning PHP - weekend course / hobby / club / leisure users course. If you have a group of three or more trainees who need to learn the subject, we can also arrange a private or on site course for you.

Books covering this topic
Yes. We have over 700 books in our library. Books covering PHP are listed here and when you've selected a relevant book we'll link you on to Amazon to order.

Other Examples
This example comes from our "Complete example - Registering for a get-together" training module. You'll find a description of the topic and some other closely related examples on the "Complete example - Registering for a get-together" module index page.

Full description of the source code
You can learn more about this example on the training courses listed on this page, on which you'll be given a full set of training notes.

Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License.

Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre.
The Horse's mouth provides a daily tip or thought.
• Further resources are available via the resources centre.
• All of these resources can be searched through through our search engine
• And there's a global index here.

Web site author
This web site is written and maintained by Well House Consultants.

Purpose of this website
This is a sample program, class demonstration or answer from a training course. It's main purpose is to provide an after-course service to customers who have attended our public private or on site courses, but the examples are made generally available under conditions described below.

Conditions of use
Past attendees on our training courses are welcome to use individual examples in the course of their programming, but must check the examples they use to ensure that they are suitable for their job. Remember that some of our examples show you how not to do things - check in your notes. Well House Consultants take no responsibility for the suitability of these example programs to customer's needs.

This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details.

Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/ex.php • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb