Hi all,
Am working in a law firm and sometimes, we need to prepare content pages with hundreds of pages of documents. As such, the moment you make one changes, you literally have to go through the whole list just to change the page number, manually.
The problem is, the pages will normally be labelled e.g. ‘1-3’, ‘4-7’ etc. so it is quite impossible even to use Excel to automatically add e.g. 1 more page to them.
I’ve tried to write a script to help solve this problem (more of as practice on a super beginners level) but I’ve more or less just put together some codes here and there that I found on the net but obviously it is not working.
Could someone please help. Basically if I have a table with docs:
Doc 1 | 1 - 3
Doc 2 | 4 - 8
Dcc 3 | 9 - 12
…
And I want to insert another document between Doc 2 and 3, I want to be able to change it them to
Doc 1 | 1 - 3
Doc 2 | 4 - 8
NEW Doc | 9 - 10
Doc 3 | 11 - 14
So in such a scenario I’d probably just want to start changing the numbers from Doc 3 onwards by adding 2.
This is the frankenstein script that I’ve attempted:
[php]<?php
//Getting values from form
$_GET[“numbers”];
$_GET[“value”];
//Breaking data into arrays
$data = explode("-", $_POST[‘numbers’]);
$data = explode("\n", $_POST[‘numbers’]);
$arr = array ($data);
foreach ($arr as &$pages) {
$pages = $pages + $value;
}
//Table Start
print “
”; } else{ // ODD print “$pages.-”; } } //Table End |
?>[/php]
Advice will be much appreciated!