Ive got a download section that someone else worked on previously and I am thinkig of ways how I can recreate the code behind it making it easier. I am seeing down the road and it loooks like its gonna be a mess if I continue coding it like the way it is. This is how it works:
- There is a form with some check boxes (right now 5). Based on the check box a user selects, they get to donwload that specific PDF file.
- Once selected, then on the code there is a bunch of if else statements that check for the combination of PDF file selections a user might have. Example:
if pdf = 1 then
<a href="/pdf1.pdf" target="_blank">
else if
if pdf = 2 then
<a href="/pdf3.pdf" target="_blank">
but where it gets tricky is when a user selects for example pdf files 1,3,5 then I have to start bulding more if else statements that will meet all different selections a user might select.
if pdf ="1, 3, 5" then
<a href="/pdf1.pdf" target="_blank">
<a href="/pdf3.pdf" target="_blank">
<a href="/pdf5.pdf" target="_blank">
currently there is about 220 lines of just if else statements that try go accomodate for a users different selection criteria they might want. They plan on adding more pdf files for downloads and I am seeing a nightmare!
I have some ideas like putting the PDF names on arrays and having a pointers extract the specified file. But ughg, I think there might a shorter way to do this. I would like some input from you guys to see if some ideas can be sparked. Thanks Community!
Bookmarks