It's not working now because your onclick isn't formatted correctly. You are giving it just a php file name.
echo "<input type='button' value='Print Labels' align='center' name=$me onclick='print_test.php'/>";
Here is how to fix that, but I think you may want to do something a little bit differently.
echo "<input type='button' value='Print Labels' align='center' name=$me onclick='document.location=\'print_test.php\''/>";
Now when the button is clicked, that will go to print_test.php correctly. The reason I don't think that is going to work, is you don't end up with any post/get vars, because a button does not submit a form. So if you were going to print records based on an id that was a part of the form, it would make it to print_test.php because a form is not posting them.
I think it may be easier for you to build the form inside your if statement. Then you can decide based on showIt/getIt what file location the form will post to. Then use a submit button instead of just a button, and your form will post to print_test.php. That means all the post/get vars will make it, and you can grab the records based on the id.
Something like this for the first part
if ( !$_POST ) {
//empty action is the same as posting back to the same page.
echo "<form method='post' enctype='multipart/form-data' action='' onsubmit='return validate_form(this);'>\n";
getIt();
}else{
//So here we will post the form with the action as where we want it to go
//when we press print. You will need to set the form up inside the showIt to
//get the values though.
echo "<form method='post' enctype='multipart/form-data' action='test_print.php' onsubmit='return validate_form(this);'>\n";
showIt();
}
Make sense? How you have it currently the data you are trying to print won't make it to the print.php page. So you have to somehow get the request to the print page, this is probably goign to mean in the showIt function converting what used to be the user input forms to be hidden inputs with the values of the user form.