I'm fairly new to creating functions and am wondering if this shouldn't actually be written some other way. Basically what I am trying to do is create a list of items to populate a drop down list from a database. This list is used in multiple locations on a single form (and in multiple forms for that matter) so I thought it would be best to write this as it's own function. I am not returning any value, and I am not sure if it is in my code for the function itself, or someplace else.

Here is the code for the function:
PHP Code:
// Build the ALL Jobs drop down list
function GetAllJobs()
{
    
// First clear the returned variable of old data
    
$AllJobs '';
    
// Connect to DB and retrieve records
    
include_once('../inc_dbconnect.inc');
    
$GetSQL 'SELECT Job_Number, Company_Name FROM Jobs ORDER BY Job_Number';
    
$GetResult mysqli_query($db_server$GetSQL) or die("Unable to run query: " mysqli_error());
    
// Set the first/default value
    
$AllJobs "<option value=\"None\">None</option>";
    
// Now loop through the results and populate the variable
    
while ($GetRow mysqli_fetch_array($GetResult))
    {
        
$JobNum $GetRow['Job_Number'];
        
$DropInfo $JobNum " ~ " $GetRow['Company_Name'];
        
$AllJobs .= "<option value=\"$JobNum\">$DropInfo</option>";
    }
    return 
$AllJobs;

In my form I make a call to the function at the top of the file, then echo $AllJobs where I want the results to be displayed (i.e. between the <select> statements. I know the database calls are working, and the proper records are being pulled from the db.

Any guidance is greatly appreciated, even if that guidance starts with "What the heck are you thinking?!?!?!)

Greg