I have a PHP script that is a combination of a purchased script and my own programming. It is a mess right now and not easy to work with at all.

Basically, the purchased script is one that will merger PDF files into one and let the user download the single PDF file. That's not the problem, that works great.

What I have is a page that has some check boxes, based on what is checked, I need the script to know what PDF files to merge together, and the PDFs must be in a specific order.

Right now I have a TON of IF statements to determine every possible combination of checkboxes. It works, but if I need to add something or change something, it takes forever.

Here's an example of one IF statement:

```
if((isset($_POST['N_P_L'])) && (isset($_POST['S_P_L'])) && (isset($_POST['Coarse'])) && (isset($_POST['Fine'])) && (isset($_POST['Pigment'])) && (isset($_POST['IWR'])) && (isset($_POST['NCA'])))
{
$com->Merge($path."/pdfs/cover/cover_form_pl.pdf|".$path."/pdfs/cover/cover_form_pl.pdf|".$path."/pdfs/cover/Leeds.pdf|".$path."/pdfs/cover/test_results.pdf|".$path."/pdfs/cover/technical_notice.pdf|".$path."/pdfs/current/mortars/n/n_p_l.pdf|".$path."/pdfs/current/mortars/s/s_p_l.pdf|".$path."/pdfs/current/grouts/3000_psi_coarse_grout.pdf|".$path."/pdfs/current/grouts/3000_psi_fine_grout.pdf|".$path."/pdfs/current/pigment/solomon.pdf|".$path."/pdfs/current/pigment/prism.pdf|".$path."/pdfs/current/pigment/dcs.pdf|".$path."/pdfs/current/additives/iwr.pdf|".$path."/pdfs/current/additives/nca.pdf|".$path."/pdfs/cover/certs.pdf|".$path."/pdfs/current/certs/holcim.pdf|".$path."/pdfs/current/certs/western_lime.pdf|".$path."/pdfs/cover/mill_tests.pdf|".$path."/pdfs/current/mill_tests/holcim.pdf|".$path."/pdfs/current/mill_tests/western_lime.pdf|".$path."/pdfs/current/mill_tests/mason_sand.pdf|".$path."/pdfs/current/mill_tests/#2_sand.pdf|".$path."/pdfs/current/mill_tests/pea_gravel.pdf|".$path."/pdfs/cover/msds.pdf|".$path."/pdfs/current/msds/pl.pdf|".$path."/pdfs/current/msds/grout.pdf|".$path."/pdfs/current/pigment/solomon_msds.pdf|".$path."/pdfs/current/pigment/prism_msds.pdf|".$path."/pdfs/current/additives/iwr_msds.pdf|".$path."/pdfs/current/additives/nca_msds.pdf|", $path."temp/submittal.pdf");
}
```

That will merge ALL of those PDF files, in that order, if every box is checked.

Here's another IF statement further down the page:

```
//n,c,f,p
if((isset($_POST['N_P_L'])) && (!isset($_POST['S_P_L'])) && (isset($_POST['Coarse'])) && (isset($_POST['Fine'])) && (isset($_POST['Pigment'])) && (!isset($_POST['IWR'])) && (!isset($_POST['NCA'])))
{
$com->Merge($path."/pdfs/cover/cover_form_pl.pdf|".$path."/pdfs/cover/Leeds.pdf|".$path."/pdfs/cover/test_results.pdf|".$path."/pdfs/cover/technical_notice.pdf|".$path."/pdfs/current/mortars/n/n_p_l.pdf|".$path."/pdfs/current/grouts/3000_psi_coarse_grout.pdf|".$path."/pdfs/current/grouts/3000_psi_fine_grout.pdf|".$path."/pdfs/current/pigment/solomon.pdf|".$path."/pdfs/current/pigment/prism.pdf|".$path."/pdfs/current/pigment/dcs.pdf|".$path."/pdfs/cover/certs.pdf|".$path."/pdfs/current/certs/holcim.pdf|".$path."/pdfs/current/certs/western_lime.pdf|".$path."/pdfs/cover/mill_tests.pdf|".$path."/pdfs/current/mill_tests/holcim.pdf|".$path."/pdfs/current/mill_tests/western_lime.pdf|".$path."/pdfs/current/mill_tests/mason_sand.pdf|".$path."/pdfs/current/mill_tests/#2_sand.pdf|".$path."/pdfs/current/mill_tests/pea_gravel.pdf|".$path."/pdfs/cover/msds.pdf|".$path."/pdfs/current/msds/pl.pdf|".$path."/pdfs/current/msds/grout.pdf|".$path."/pdfs/current/pigment/solomon_msds.pdf|".$path."/pdfs/current/pigment/prism_msds.pdf|", $path."temp/submittal.pdf");
}
```

I literally have about 100 of these for each possible combination.

There's gotta be an easier way!

I haven't taken many programming classes, and I'm not too familiar with PHP, but any help would be appreciated.