prepopulate form from a hook within wordpress function.php file

You will need to declare the variable global before using it.

function simple_form(){
    global $firstname;
    $firstname="Bob";
    //Do something to populate the form field name <fname> with "Bob"
}

Your form should be able to do …

global $firstname;
echo $firstname;

… to use the variable.

However, I can’t help but think there is a better way to do this.

  1. Setting a global is best avoided if you can
  2. and doing what you are doing– hooking to wp— you are going to populate these variable for every page on the site– both front and back end– every time a page loads. That is a waste of resources. There are many, many other hooks and I am pretty sure that one of them would work much better than wp.

Without having more details about your project I don’t think I can do better than generalities but edit your question and I will edit my answer.