View Full Version : Putting $_POST values into a text mail

11-19-2012, 10:13 PM
I am trying to make an online ordering system for our shop using HTML, php and mysql. We need to send the customers a confirmation email. I am using the simple mail() function. The first part of the message comes through just fine, but not the actual product (there are actually about 150 "hats" and I do not want to send the customer a long mail with 149 things that he has not ordered). Here is the code - what am I doing wrong? Any hints greatly appreciated!

$to = "{$_POST['email']}";
$subject = "Order No. {$result["mysql_insert_id"]}";
$message = "Thank you for your Order.\n
Your order number is {$result["mysql_insert_id"]} (you will need to provide this number when you collect the order).\n
Your order was taken by {$_POST['takenBy']} on {$_POST['orderDate']} \n
{$_POST['name']} {$_POST['surname']} \n
{$_POST['email']} \n
Tel. {$_POST['telephone']} \n
Your order will be ready to collect from {$_POST['takenAt']} on {$_POST['collectDate']} \n
Deposit Paid: {$_POST['deposit']}\n";

$message .= if ($_POST['qty12'] > 0) echo "{$_POST['qty12']}" . " Hats - red<br/>";
if ($_POST['qty13'] > 0) echo "{$_POST['qty13']}" . " Hats - orange<br/>";
if ($_POST['qty14'] > 0) echo "{$_POST['qty14']}" . " Hats - yellow<br/>";
if ($_POST['qty15'] > 0) echo "{$_POST['qty15']}" . " Hats - green<br/>";
if ($_POST['qty16'] > 0) echo "{$_POST['qty16']}" . " Hats - blue<br/>";
if ($_POST['qty17'] > 0) echo "{$_POST['qty17']}" . " Hats - indigo<br/>";
if ($_POST['qty18'] > 0) echo "{$_POST['qty18']}" . " Hats - violet<br/>";

$from = "mymail@mac.com";
$headers = "From:" . $from;

11-19-2012, 10:24 PM
Sorry to say this, but you're going down the wrong road.

Show us your actual form, or the URL to the form on your website.
Your form will contain variable arrays, not individual names for each variable.
This will simplify it for you immensely.

11-19-2012, 10:42 PM
I fear I am altogether on the wrong path - this is the first interactive thing I've tried. Here is the code for the input page - sorry it's huge! I took a load of the JS out in the middle to make it fit.

<div id="wrapper">

<!-- product catagory select checkboxes -->

<p> Turkeys and Geese <input type="checkbox" name="turkeysAndGeese" id="turkeysAndGeese" tabindex="165" />
&nbsp; &nbsp; Stuffing products <input type="checkbox" name="stuffing" id="stuffing" tabindex="171" />
&nbsp; &nbsp; Poultry <input type="checkbox" name="Poultry" id="Poultry" tabindex="166" />
&nbsp; &nbsp; Fresh meat <input type="checkbox" name="freshMeat" id="freshMeat" tabindex="168" />
&nbsp; &nbsp; Sausage and bacon <input type="checkbox" name="sausageAndBacon" id="sausageAndBacon" tabindex="169" />
Cooked and deli <input type="checkbox" name="cookedAndDeli" id="cookedAndDeli" tabindex="167" />
&nbsp; &nbsp; Specials <input type="checkbox" name="specials" id="specials" tabindex="170" />
&nbsp; &nbsp; notes <input type="checkbox" name="showNotes" id="showNotes" tabindex="171" />

<!-- individual turkey and goose line reveal checkboxes -->
<div id="TandGselection">
<div id ="col1">
<p><button type="button" onClick="document.getElementById('qty12').style.display='block';">+</button><label for="TurkeyXL">Turkey XL 7.5-9.0 kg</label></p>
<p><button type="button" onClick="document.getElementById('qty13').style.display='block';">+</button><label for="TurkeyL">Turkey L 6.5-7.5 kg</label></p>
<p><button type="button" onClick="document.getElementById('qty35').style.display='block';">+</button><label for="ChickenLiver">Chicken Liver</label></p>
<p><button type="button" onClick="document.getElementById('qty36').style.display='block';">+</button><label for="ChickenLegs">Chicken Legs</label></p>
<p><button type="button" onClick="document.getElementById('qty37').style.display='block';">+</button><label for="ChickenBreast">Chicken Breast</label></p>
onClick="document.getElementById('qty150').style.display='block';">+</button><label for="porkAndChestnut">Pork and Chestnut</label></p>
<p><button type="button" onClick="document.getElementById('qty151').style.display='block';">+</button><label for="sausageMeat">Sausage Meat</label></p>
<p><button type="button" onClick="document.getElementById('qty152').style.display='block';">+</button><label for="sageAndOnion">Sage and Onion</label></p>

<!--<div id="notesSelection">
<div class="col1">
<p><button type="button" onClick="document.getElementById('notes').style.display='block';">+</button><label for="notes">Notes</label></p>

<form method="post" action="submitOrder.php">
<div id="orderDiv">
<p><label for="orderDate"></label><input type="hidden" name="orderDate" value="<?php
echo date("Y-m-d ", time());?>"></p>
<p><label for="Name">First Name: </label><input type="text" name="name" size="30" maxlength="70" required="required" />

<label for="Surname">Surname </label><input type="text" name="surname" size="30" maxlength="70" required="required" >

<label for="email">Email: </label><input type="email" name="email" size="30" maxlength="50" required="required" ></p>

<p><label for="telNo">Tel. No: (no spaces)</label><input type="tel" name="telephone" size="15" maxlength="15" required="required" value=>

<label for="takenBy">Taken by: </label>
<select size="1" id="select_taken_by" name="takenBy" required="required">
<option> </option>



<label for="takenAt">Collect from:</label>
<select size="1" id="slt_taken_at" name="takenAt" required="required">
<option> </option>
<option>The Farm</option>

<label for="deposit">Deposit: </label><select size="1" id="deposit" name="deposit" >
<option> 20 </option>
<option> 5 </option>

<label for="ogoneNo">Payment ref.</label><input type="text" name="ogoneNo" size="15" maxlength="15" required="required" >(Enter PDQ/cash/Ogone ref)</p>
<p> <label for="collectionDate">Collection date: </label><input type="date" name="collectDate" required="required">

<label for="status">Status: </label><input type="hidden" name="status" value="New">
<label for="specialCare">Flag</label>
<select size="1" id="slt_specialCare" name="specialCare">

<label for="marketing">marketing</label>
<select size="1" id="slt_marketing" name="marketing">


<!--these are the elements which will be revealed by product select checkboxes and will post values through -->
<!--Turkey and goose qtys-->
<div id="qty12"> Turkey Extra large 7.5-9.0kg 11.50 per kg<input type="number" name="qty12" size="4" ></div>
<div id="qty13"> Turkey large 6.5-7.5kg 11.50 per kg<input type="number" name="qty13" size="4" ></div>
<div id="qty14"> Turkey Medium 5.5-6.5kg 11.50 per kg<input type="number" name="qty14" size="4" ></div>
<div id="qty15"> Turkey Small 4.5-5.5kg 11.50 per kg<input type="number" name="qty15" size="4" ></div>
<div id="qty16"> Goose Extra large 6.0+kg 13.50 per kg<input type="number" name="qty16" size="4" ></div>
<div id="qty17"> Goose Large 5.5-6.0kg 13.50 per kg<input type="number" name="qty17" size="4" ></div>
<div id="qty18"> Goose Medium 4.5-5.5kg 13.50 per kg<input type="number" name="qty18" size="4" ></div>
<div id="qty19"> Goose Small 4.0-4.5kg 13.50 per kg<input type="number" name="qty19" size="4" ></div>

<div id="qty33"> Chicken 100 day old 1.8-2.5kg 9.50/kg<input type="number" name="qty33" size="4" ></div>
<div id="qty34"> Chicken french (yellow poule des Landes) 1.8kg 8.50/kg<input type="number" name="qty34" size="4" ></div>
<div id="qty35"> Chicken Liver 7.50 kg<input type="number" name="qty35" size="6" step="any" ></div>
<div id="qty36"> Chicken Legs 7.50 kg<input type="number" name="qty36" size="4" ></div>
<div id="qty37"> Chicken Breast 14.00 kg<input type="number" name="qty37" size="4" ></div>

<!--cookedAndDeli qtys-->
<div id="qty38"> Black Pudding 15.50 kg<input type="number" name="qty38" size="6" step="any" ></div>
<div id="qty39"> Brandied Apricot Pate 28.50 kg<input type="number" name="qty39" size="6" step="any" ></div>
<div id="qty40"> Duck and Pistachio Pate 28.50 kg<input type="number" name="qty40" size="6" step="any" ></div>
<div id="qty41"> Ham Cooked glazed plain boneless 16.50 kg<input type="number" name="qty41" size="6" step="any" ></div>
<div id="qty42">Ham Cooked glazed plain on the bone 15.00 kg<input type="number" name="qty42" size="4" ></div>
<div id="qty43"> Ham Cooked glazed smoked boneless 17.50 kg<input type="number" name="qty43" size="6" step="any" ></div>
<div id="qty44"> Ham Cooked glazed smoked on the bone 16.00 kg<input type="number" name="qty44" size="4" ></div>
<div id="qty45"> Ham Sliced plain 16.50 kg<input type="number" name="qty45" size="6" step="any" ></div>
<div id="qty46"> Ham Sliced smoked 17.50 kg<input type="number" name="qty46" size="6" step="any" ></div>
<div id="qty47"> Mince Pie 1.10 each<input type="number" name="qty47" size="4" ></div>
<div id="qty48"> Pastrami 22.00 kg<input type="number" name="qty48" size="6" step="any" ></div>
<div id="qty49"> Pate Campagne 24.50 kg<input type="number" name="qty49" size="6" step="any" ></div>
<div id="qty54"> Pie in dish Lamb and Apricot <input type="number" name="qty54" size="4" ></div>
<div id="qty55"> Pie in dish Mutton and Black Pudding <input type="number" name="qty55" size="4" ></div>
<div id="qty56"> Pie in dish Pork and Leek in Cider/Creamy Mustard Sauce <input type="number" name="qty56" size="4" ></div>
<div id="qty57"> Pie in dish Steak and Ale <input type="number" name="qty57" size="4" ></div>
<div id="qty58"> Pie in dish Steak and Kidney <input type="number" name="qty58" size="4" ></div>
<div id="qty59"> Pie in dish Steak and Stilton <input type="number" name="qty59" size="4" ></div>
<div id="qty60"> Pork and Brandied Apricot Pie 8.50 each<input type="number" name="qty60" size="4" ></div>
<div id="qty61">Pork Pie Large 12.50 each<input type="number" name="qty61" size="4" ></div>
<div id="qty62">Pork Pie Standard 5.50 each<input type="number" name="qty62" size="4" ></div>
<div id="qty63"> Raised Game Pie 8.50 each<input type="number" name="qty63" size="4" ></div>
<div id="qty64"> Rillets of Pork 24.50 kg<input type="number" name="qty64" size="6" step="any" ></div>
<div id="qty65">Roast Beef sliced 19.50 kg<input type="number" name="qty65" size="6" step="any" ></div>
<div id="qty66"> Royal Pie 26.50 each<input type="number" name="qty66" size="4" ></div>
<div id="qty67"> Sausage Rolls Merguez 4.00 each<input type="number" name="qty67" size="4" ></div>
<div id="qty68"> Sausage Rolls Pork and Stiton 4.00 each<input type="number" name="qty68" size="4" ></div>
<div id="qty69"> Sausage Rolls Spicy Lamb 4.00 each<input type="number" name="qty69" size="4" ></div>
<div id="qty70"> Sausage Rolls Traditional 3.50 each<input type="number" name="qty70" size="4" ></div>
<!--fresh meat 71 to 122 inc-->
<div id="qty71"> Beef Braising steak 12.50 kg<input type="number" name="qty71" size="6" step="any" ></div>
<div id="qty72"> Lamb Neck Fillet 16.80 kg<input type="number" name="qty72" size="6" step="any" ></div>
<div id="qty73"> Lamb Loin 24.50 kg<input type="number" name="qty73" size="6" step="any" ></div>
<div id="qty74"> Lamb Leg steak 24.50 kg<input type="number" name="qty74" size="4" ></div>
<div id="qty75">Lamb Leg rolled boneless 16.50 kg <input type="number" name="qty75" size="6" step="0.5" ></div>
<div id="qty76">Lamb Leg on the bone 14.50 kg <input type="number" name="qty76" size="6" step="0.5" ></div>
<div id="qty77"> Lamb Diced 15.50 kg<input type="number" name="qty77" size="6" step="any" ></div>
<div id="qty78"> Lamb Chop/loin 24.50 kg<input type="number" name="qty78" size="4" ></div>
<div id="qty79"> Lamb Breasts 3.50 each<input type="number" name="qty79" size="4" ></div>
<div id="qty80">Beef Topside 15.00 kg <input type="number" name="qty80" size="6" step="any" ></div>
<div id="qty81"> Beef T Bone 24.00 kg<input type="number" name="qty81" size="4" ></div>
<div id="qty82"> Beef Stewing Steak 10.50 kg<input type="number" name="qty82" size="6" step="any" ></div>
<div id="qty83"> Beef Sirloin Rolled Boneless 33.00 kg<input type="number" name="qty83" size="6" step="any" ></div>
<div id="qty84"> Beef Sirloin On the bone/Wingrib 3 bone 22.50 kg<input type="number" name="qty84" size="4" ></div>
<div id="qty85"> Beef Sirloin On the bone/Wingrib 2 bone 22.50 kg<input type="number" name="qty85" size="4" ></div>
<div id="qty86">Beef Silverside/Salmon Cut 13.50 kg <input type="number" name="qty86" size="6" step="any" ></div>
<div id="qty87">Beef Rump 21.50 kg<input type="number" name="qty87" size="6" step="any" ></div>
<div id="qty88"> Beef Ribeye 29.50 kg<input type="number" name="qty88" size="6" step="any" ></div>
<div id="qty89"> Beef Oxtongue 9.50 kg<input type="number" name="qty89" size="4" ></div>
<div id="qty90">Beef Oxtail 11.50 kg<input type="number" name="qty90" size="6" step="any" ></div>
<div id="qty91">Beef Mince 9.50 kg <input type="number" name="qty91" size="6" step="any" ></div>
<div id="qty92">Beef Kidney 5.50 kg <input type="number" name="qty92" size="6" step="any" ></div>
<div id="qty93"> Beef Forerib 5 bones 19.50 kg<input type="number" name="qty93" size="4" ></div>
<div id="qty94">Beef Forerib 4 bones 19.50 kg <input type="number" name="qty94" size="4" ></div>
<div id="qty95"> Beef Forerib 3 bones 19.50 kg<input type="number" name="qty95" size="4" ></div>
<div id="qty96"> Beef Forerib 2 bones 19.50 kg<input type="number" name="qty96" size="4" ></div>
<div id="qty97"> Beef Fillet Tail 30.00 kg<input type="number" name="qty97" size="6" step="any" ></div>
<div id="qty98"> Beef Fillet 49.00 kg<input type="number" name="qty98" size="6" step="any" ></div>
<div id="qty99">Beef Cote de boeuf 5 bones 27.50 kg <input type="number" name="qty99" size="4" ></div>
<div id="qty100">Beef Cote de boeuf 4 bones 27.50 kg<input type="number" name="qty100" size="4" ></div>
<div id="qty101">Beef Cote de boeuf 3 bones 27.50 kg<input type="number" name="qty101" size="4" ></div>
<div id="qty102">Beef Cote de boeuf 2 bones 27.50 kg<input type="number" name="qty102" size="4" ></div>
<div id="qty103">Beef Chuck Steak 13.50 kg<input type="number" name="qty103" size="6" step="any" ></div>
<div id="qty104">Lamb Rack French trimmed 32.00 kg<input type="number" name="qty104" size="6" step="0.5" ></div>
<div id="qty105">Lamb Saddle Rolled 33.50 kg<input type="number" name="qty105" size="4" ></div>
<div id="qty106">Lamb Shanks 13.50 kg<input type="number" name="qty106" size="4" ></div>
<div id="qty107">Lamb Shoulder on the bone 11.50 kg<input type="number" name="qty107" size="6" step="0.5" ></div>
<div id="qty108">Lamb Shoulder rolled boneless 13.50 kg<input type="number" name="qty108" size="4" ></div>
<div id="qty109">Pork Belly 8.50 kg<input type="number" name="qty109" size="6" step="any" ></div>
<div id="qty110">Pork Fillet 16.50 kg<input type="number" name="qty110" size="6" step="any" ></div>
<div id="qty111">Pork Hocks Plain 4.50 kg<input type="number" name="qty111" size="4" ></div>
<div id="qty112">Pork Hocks Smoked 5.50 kg<input type="number" name="qty112" size="4" ></div>
<div id="qty113">Pork Leg Boneless 9.80 kg<input type="number" name="qty113" size="6" step="any" ></div>
<div id="qty114">Pork Leg On the bone 8.00 kg<input type="number" name="qty114" size="6" step="any" ></div>
<div id="qty115">Pork Loin on the bone/chop 12.50 kg<input type="number" name="qty115" size="6" step="any" ></div>
<div id="qty116">Pork Loin Rolled 16.50 kg<input type="number" name="qty116" size="6" step="any" ></div>
<div id="qty117">Pork Mince 9.50 kg<input type="number" name="qty117" size="6" step="any" ></div>
<div id="qty118">Pork Ribs 9.50 <input type="number" name="qty118" size="6" step="any" ></div>
<div id="qty119">Pork Shoulder on the Bone 9.50 kg<input type="number" name="qty119" size="6" step="any" ></div>
<div id="qty120">Pork Shoulder Rolled 12.50 kg<input type="number" name="qty120" size="6" step="any" ></div>
<div id="qty121">Pork Steak 14.50 kg<input type="number" name="qty121" size="6" step="any" ></div>
<div id="qty122">Pork Trotters 1.00 each<input type="number" name="qty122" size="4" ></div>

<!--Sausages and Bacon 123 to 144 inc-->
<div id="qty123">Sausages Traditional 10.50 kg<input type="number" name="qty123" size="6" step="any" ></div>
<div id="qty124">Sausages Toulouse 10.50 kg<input type="number" name="qty124" size="6" step="any" ></div>
<div id="qty125">Sausages Prune and Brandy 10.50 kg<input type="number" name="qty125" size="6" step="any" ></div>
<div id="qty126">Sausages Garlic Toulouse 10.50 kg<input type="number" name="qty126" size="6" step="any" ></div>
<div id="qty127">Sausages Cumberland 10.50 kg<input type="number" name="qty127" size="6" step="any" ></div>
<div id="qty128">Sausages Cracked Black Pepper 10.50 kg<input type="number" name="qty128" size="6" step="any" ></div>
<div id="qty129">Sausages Cocktail 12.50 kg<input type="number" name="qty129" size="6" step="any" ></div>
<div id="qty130">Sausages Chorizo 10.50 kg<input type="number" name="qty130" size="6" step="any" ></div>
<div id="qty131">Sausages Chipolata 11.50 kg<input type="number" name="qty131" size="6" step="any" ></div>
<div id="qty132">Gammon Uncooked Smoked on the Bone 12.00 kg<input type="number" name="qty132" size="6" step="0.5" ></div>
<div id="qty133">Gammon Uncooked Smoked Boneless 14.50 kg<input type="number" name="qty133" size="6" step="any" ></div>
<div id="qty134">Gammon Uncooked Plain on the Bone 11.00 kg<input type="number" name="qty134" size="6" step="0.5" ></div>
<div id="qty135">Gammon Uncooked Plain Boneless 13.50 kg<input type="number" name="qty135" size="6" step="any" ></div>
<div id="qty136">Gammon Steak Smoked 15.00 kg<input type="number" name="qty136" size="6" step="any" ></div>
<div id="qty137">Gammon Steak Plain 14.00 kg<input type="number" name="qty137" size="6" step="any" ></div>
<div id="qty138">Bacon Back Plain 16.00 kg<input type="number" name="qty138" size="6" step="any" ></div>
<div id="qty139">Bacon Streaky Smoked 15.00 kg<input type="number" name="qty139" size="6" step="any" ></div>
<div id="qty140">Bacon Streaky Plain 14.00 kg<input type="number" name="qty140" size="6" step="any" ></div>
<div id="qty141">Bacon Long Back Smoked 16.00 kg<input type="number" name="qty141" size="6" step="any" ></div>
<div id="qty142">Bacon Long Back Plain 15.00 kg<input type="number" name="qty142" size="6" step="any" ></div>
<div id="qty143">Bacon Collar 9.80 kg<input type="number" name="qty143" size="6" step="any" ></div>
<div id="qty144">Bacon Back Smoked 17.00 kg<input type="number" name="qty144" size="6" step="any" ></div>

<!--Specials 145 to 149 inc-->
<div id="qty145">Venison Leg Steak 22.50 kg<input type="number" name="qty145" size="6" step="any" ></div>
<div id="qty146">Cooked Tongue 16.50 kg<input type="number" name="qty146" size="6" step="any" ></div>
<div id="qty147">Salt Beef 10.50 kg<input type="number" name="qty147" size="6" step="any" ></div>
<div id="qty148">Suckling Pig 14.50 kg<input type="number" name="qty148" size="4" ></div>
<div id="qty149">Venison Loin 48.00 kg<input type="number" name="qty149" size="6" step="any" ></div>
<div id="qty50"> Veal Escalope 28.00 kg <input type="number" name="qty50" size="6" step="any" ></div>
<div id="qty51"> Veal Loin on the bone 28.50 kg <input type="number" name="qty51" size="6" step="any" ></div>
<div id="qty52"> Veal Osso Bucco 18.50 kg <input type="number" name="qty52" size="6" step="any" ></div>
<div id="qty53"> Veal Topside Roast 28.00 kg <input type="number" name="qty53" size="6" step="any" ></div>

<!--Stuffing products 150 to 152 inc-->
<div id="qty150">Pork and Chestnut 11.50 kg<input type="number" name="qty150" size="6" step="any" ></div>
<div id="qty151">Sausage Meat 10.00 kg<input type="number" name="qty151" size="6" step="any" ></div>
<div id="qty152">Sage and Onion 11.50 kg<input type="number" name="qty152" size="6" step="any" ></div>
<br />

<div id="notes"> Notes <textarea name="notesInput" id="notesInput" rows="3" cols="80" > </textarea><br />
<input type="submit" name="submit2" id="submitBtn" value="place order"/>

<script src="javascripts/script.js"></script>

11-19-2012, 11:40 PM
You said that you have a MySQL database, is that correct?

How is it structured ...
Give example of some MySQL table names and column (field) names.

I'm assuming it is similar to this?

unique row ID | item number | description | type | category | cost | photo URL | inventory qty

125 | HC100 | Ham Cooked glazed smoked boneless 17.50 | ham cooked | ham | 17.50 | hc100.jpg | 23

So you can do various queries ...
find all rows with the category 'ham'. or 'pork', or 'chicken'
find all rows with the type 'ham cooked', or 'ham sliced'

As you do queries and build the HTML form 'dynamically', each
value of checkbox is the 'unique id' number of the row.
If you add or delete rows, those unique id' numbers are never
repeated nor are they ever used again.

Example: if one of my checkboxes is 125, I know that they selected the ham item HC100.

You need to get the database organized and determine the scheme of how you
wish to lay it out. You also need another database table for the users?

So, start with getting the database done correctly and go from there.


11-20-2012, 12:10 AM
I have a MySQL database with two tables - orders and users. Users is simple, just the names and p/w of the people who can log in and place orders. Orders is more complicated, it is: unique row id (orderNo)then 10 fields of customer info including | collectDate | followed by 140 fields labled | qty12 | qty13 | qty14 | etc. I used qty12 etc. rather than the actual product name as the products change quite a lot with the seasons and we would be continually adding columns to the DB - which might in retrospect have been a better solution. We query the DB to find eg. SUM(qty12) WHERE collectDate = 2012-11-22 and also SELECT * WHERE orderNo = xyz to print a copy for the staff to pick the order. This all works fine. My problem is that to construct the confirmation mail I need to get the non 0 values out of the post array and turn qty12 into smoked cooked ham (for example) and put this info into $message for the mail.

11-20-2012, 01:00 AM
oh my.

Do you see why one row for EACH product would be a better way to do this?

You add a row when you add a new product.
You delete a row (or have a field called 'enable') when you remove a product.
Add a column called 'season' if you wish to associate a product with a season.

It is great that you're diving into PHP/MySQL though ... I'll give you points for that.
You'll learn a lot by making mistakes and asking questions. You'll just have to
either trust me on my advice to start over, or keep plowing ahead and see where
you end up.

I won't even attempt to try coding a script example that you desire. Sorry, but
your method is just too wrong. I really suggest you hire a freelance programmer
to assist you.

My goal is for you to keep at it ... I don't want to discourage you.


11-21-2012, 02:40 PM
Thanks for your advice - I know I'm out of my depth, but I learn faster when it's for "real". I managed to resolve the question with some inelegant php contortions, so the system works for now. I will keep it on line 'till Christmas as it is a considerable advance on last years model - faxing and copying bits of paper and hand entering into a spreadsheet! After that I will take it off line and completely redesign it in light of the experience gained.
Out of interest, how does one go about getting freelance help?

11-21-2012, 03:58 PM
There is a section on this forum called "Web Projects", where you can
request programming help (hire a freelancer). Show them this thread
and explain your requirements.

I've never experienced using that part of the forum, so I can't tell you
how well it will work. There are experienced programmers all over the
world, so you just want to make sure that the person you hire speaks
your native language fluently. Communication with emails, phone calls,
etc. depends on understanding each other.

You also need to trust the person ... as they will need full access to your
website, your MySQL database, your FTP ... all files. With your webhost
control panel, you can create separate logins for other people. Perhaps
the freelancer should be given their own FTP login, and you should create
a new MySQL database for them to use?