So I have this array in my config.php file. Now what I am doing is calling the array (from another file) and I want to do an if type statement. I need some coding help here. The User will be redirected based on the posistion that they choose from the array, and I need a simple (even if its complex code) way to do this (simple as in, it would be easy for someone to come in, and change parts of the array and still get the same results).
----------config.php----------
<?php
//Lines that just have a , represent a blank line in the drop down menu
$array = ",
-----Help Desk Services-----,
,
Technology Support Assistant - Level 1,
Technology Support Assistant - Level 2,
Technology Support Student Team Leader,
Help Desk Services Office Assistant,
,
-----The George and Helen Ladd Library-----,
,
Acq/Student Specialist 2,
Audio/Public Services Student Assistant,
Bind and Mend/Advanced Bindery Specialist,
Catalog/Non Book/Specialist,
Catalog/Processing Assistant,
Catalog/Student Specialist,
Circ/Public Services Student Assistant,
Circ/Public Services Student Specialist,
Docs/Government Documents Assistant,
Documents Processor Student Assistant - Grade 1,
Editor/Muskie Oral History Project - Editor - Grade 2,
ILL/Borrowing Specialist,
ILL/Lending Specialist,
ILL/Photocopy Specialist,
Muskie Archives/Specialist,
Office/Student Specialist,
Public Services Student Assistant - Grade 1,
Public Services Shelving Assistants - Grade 1,
Ref/Per Mtnce Student Specialist,
Ref/Research and Technical Specialist,
Special Collections/Student Specialist - Grade 2,
Web Applications/Programmer Student Assistant";
?>
----------End of config.php----------
----------form.php----------
<select name="position">
<option name="">-----Please select a position-----</option>
<?php
//explode the array and iterate through the array
$myarray = explode(",",$array);
//create an option from each element in the array
foreach ($myarray as $item){
echo "<option name=\"$item\">$item</option>";
}
?>
</select>
----------End of form.php----------
----------form2.php----------
<?php
if($position == "//list of Help Desk Services Here")
{
//Go to Help Desk Services Form
}else(
//go to Library Services Form
}
----------End of form2.php----------
Of course there is some heading code in those pages that include config and such. Instead of doing the code I have now in form2.php, how could I do it? I need something dynamic. Isnt there a way to call the array as [0], [1] or something like that. So that the first 4 or 5 values in the array are for Help Desk Services?
Thx for any help =)