Thanks to many of you guys (namely Sic and marc2003) i have been able to turn my static form which contained the same values over and over again into a lovely little array meaning i can just loop the form/validation etc as many times as i wish without having to copy/paste code.
Now what i need to do is take the array (which is now all working and validated properly) and output it to a phprtf file. Don't worry as i have done all the phprtf code (shown below), i just need to know how to take the bits out of my array and put them into the phprtf bit of code i have previously created.
Here's the code that i need the array to go into, which will be in a for loop (unless theres a better way)...the values in the array are item, quantity, reason, type, and asset, to replace $item1, $quantity1, $reason1 etc below.
Here is a typical output using print_r for the whole form:
I know i need a loop etc but basically am not sure how to get the right bits out of the array. Any help hugely appreciated and promise once this is working im all sorted!
(fingers crossed)
Oh, and not sure if it's necessary but if you'd like to see the form (which outputs the arrays at the bottom of the page) it's here: http://www.richl.com/gpt/erf/erf_form.php.
Now what i need to do is take the array (which is now all working and validated properly) and output it to a phprtf file. Don't worry as i have done all the phprtf code (shown below), i just need to know how to take the bits out of my array and put them into the phprtf bit of code i have previously created.
Here's the code that i need the array to go into, which will be in a for loop (unless theres a better way)...the values in the array are item, quantity, reason, type, and asset, to replace $item1, $quantity1, $reason1 etc below.
Code:
// set item rows
$table->writeToCell(3, 1, '1.', $fonTopMain, $parCell);
$table->writeToCell(3, 2, $quantity1 . 'x ' . $item1, $fonTopMain, $parCell);
$table->writeToCell(3, 3, $asset1, $fonTopMain, $parCell);
$table->writeToCell(3, 4, $reason1, $fonTopMain, $parCell);
$table->writeToCell(3, 5, '[' . $type1 . ']', $fonTop, $parCell);
$table->writeToCell(3, 6, 'Status: [Authorised] ', $fonTop, $parCell);
$table->writeToCell(3, 6, '[Rejected]', $fonTopRed);
$table->writeToCell(3, 6, 'Initial:
Date:', $fonTop, $parCell);
$table->writeToCell(3, 6, '[Raise Purchase Order]', $fonTopRed, $parCell);
$table->writeToCell(3, 6, '[Use Existing Stock]', $fonTopBlue, $parCell);
Here is a typical output using print_r for the whole form:
Code:
Array ( [submit] => null [username] => [address] => Address 1 [lognumber] => [contactname] => [contactmail] => [theitem] => Array ( [0] => Brother HL-5240 [1] => Desktop PC and TFT ) [quantity] => Array ( [0] => 3 [1] => 1 ) [reason] => Array ( [0] => The old ones are broken. [1] => New person starting, needs a PC to work on. ) [thetype] => Array ( [0] => Array ( [0] => Replacement ) [1] => Array ( [0] => Enhancement ) ) [asset] => Array ( [0] => 089 [1] => ) [notes] => [Submit] => Submit ERF )
I know i need a loop etc but basically am not sure how to get the right bits out of the array. Any help hugely appreciated and promise once this is working im all sorted!
(fingers crossed)
Oh, and not sure if it's necessary but if you'd like to see the form (which outputs the arrays at the bottom of the page) it's here: http://www.richl.com/gpt/erf/erf_form.php.
Last edited: