Q:

PHP JQuery/JS - Set PHP variable to Javascript variable?

I have a huge <select> input that I call across many pages. My idea is to have this dropdown box as its own PHP file, and load it externally with JQuery. Is this even possible? Here's an example of what I'm trying to do:
if ($variable) {
   echo '<select>
         <option value="A">A</option>
         <option value="B">B</option>
         <option value="C">C</option>
         </select>';
}

If I had to make changes to the dropdown, it would be quite frustrating to go through each page that it exists on and edit this dropdown. Is there a way to load it with JQuery?

A:

Why not just store the dropdown contents in a variable in a separate php file and include the file in any script you need to use it? Let's say dropdown.php looks like this:
$dropdown = '<select>
     <option value="A">A</option>
     <option value="B">B</option>
     <option value="C">C</option>
     </select>';

and then just do
include "dropdown.php";
echo $dropdown;

wherever needed

