GO ILLINI
07-19-2007, 11:31 PM
I have a config file editor page that should read the config file, then automatically select a <option> from a <select> tag. I dont want to have to write an if-else statement for each line in the config file(there are over 200)
and I came up with 2 ways to do this and was wondering which would be easier and less cpu intensive.
1) Create a loop for each config option, and check on each step in the loop for what should be 'selected' by default.
2) Make a function to check. EX:
(checkifset prints out selected="selected")
<option other stuff checkifset('config_option','value1'); >Value 1</option>
<option other stuff checkifset('config_option','value2'); >Value 2</option>
<option other stuff checkifset('config_option','value3'); >Value 3</option>
It seems that option 2 would be easier to code(since I already have the html coded out), but it may also be more cpu intensive.
Any thoughts?
Thanks,
-Adam
and I came up with 2 ways to do this and was wondering which would be easier and less cpu intensive.
1) Create a loop for each config option, and check on each step in the loop for what should be 'selected' by default.
2) Make a function to check. EX:
(checkifset prints out selected="selected")
<option other stuff checkifset('config_option','value1'); >Value 1</option>
<option other stuff checkifset('config_option','value2'); >Value 2</option>
<option other stuff checkifset('config_option','value3'); >Value 3</option>
It seems that option 2 would be easier to code(since I already have the html coded out), but it may also be more cpu intensive.
Any thoughts?
Thanks,
-Adam