jQuery mobile Navigation breaks Javascript and Collapsible Sets are not displaying properly when loaded via ajax
===

I am building a backend system mostly for fun. I am using PHP mySQL jQuery Mobile. I am new to server side scripting and not either a beginner or intermediate at JavaScript. I am running into a couple different problems and I'm not sure if there is a better way to do it.

**Here's how the system works.** 

Guests come to my website and fill out the form. That form is then submitted via email and inserted in a database. I am wanting to create a back-end system that will allow me to retrieve, edit and save the guest info. 

**Problems I'm having...**

 1. **Page Script stops functioning after hitting the back button.**

    The records from the database are loaded via ajax from a php page that formats the data the way I want it. It shows the records under two different categories. Guests that were never contacted and Guests that need to be called back. It automatically pulls this information from the Database. I also included the functionality to click on a name and it will pull up the rest of the information on a separate page. However when you hit the back button the script doesn't execute and it doesn't show any records at all. Also I have a search function that isn't working after navigating back to the home page.

 2. **Collapsible Headers are not formatting correctly.**
    
    When you click on an individual record that record is pulled up via a different page. On this page there are several different collapsible headers. I've searched and tried several methods as mentioned on this forum and on the jQuery mobile documentation and I'm not sure if I'm implementing the calls properly or if I'm using the wrong methods.

Code that loads the records on the first page.

        	$sql="SELECT * FROM `info` WHERE LastName LIKE '%$q%' OR FirstName LIKE '%$q%' OR Phone LIKE '%$q%' ORDER BY LastName";

	$result = mysql_query($sql);
	
	while($row = mysql_fetch_array($result))
	  {
		if (mysql_num_rows($result)==0)
		  
			  echo "No matches";
				  
		else
			 
			  echo "<li data-theme='a' class='ui-li-static'><a href='record.obtain.php?m=" . $row['id'] . "' data-transition='flip'>" . $row['LastName'] . ", " . $row['FirstName'] . "<br/>" . $row['Phone'] . "</a></li>";

As you can see in the `<a>` tag it loads the data using php and you get a new page. 
*Code Below*

        $sql="SELECT * FROM info WHERE id='$m'";

	$result = mysql_query($sql);
	
	while($row = mysql_fetch_array($result))
	  {
		if (mysql_num_rows($result)==0)
		  
			  echo "No matches";
				  
		else
			
			echo "<!DOCTYPE html> <html><head><title>" . $row['FirstName'] . $row['LastName'] . "</title><meta name='viewport' content='width=device-width, initial-scale=1'><link rel='stylesheet' href='css/jquery.mobile-1.1.0.min.css' /><link rel='stylesheet' type='text/css' href='css/BoostGBS.min.css'><link rel='stylesheet' type='text/css' href='css/mobile.css'><script src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'></script><script type='text/javascript' src='js/jquery.mobile-1.1.0.min.js'></script>    	<script type='text/javascript'>
		
		$(document).ready(function(){
						
			$('#searchBox').bind('change keyup',function() {		
				var searchValue = $(this).val();
				
				if(searchValue.length <= 0 ) {
					
					$('#mainDataContainer').empty()
				
				} else {
					
					$('#mainDataContainer').load('record.obtain.php?v=mobile&q=' +searchValue, function(){
					$('#mainDataContainer').listview('refresh');
					
				});
					
				}
				
				
			});
			
			$('#mainDataContainer').load('record.obtain.php', function(){
				$('#mainDataContainer').listview('refresh');
				});
			
			
			
			
			
		});
    </script></head><body><div data-role='page'><div data-role='header'><h3>Guest Information</h3></div><div data-role='content'><div data-role='collapsible-set' data-theme='c' data-content-theme='d' id='guestInfoContainer'><div data-role='collapsible' data-collapsed='false'><h3>Contact Information</h3>";

			echo "<div><b>" . $row['FirstName'] . " " . $row['LastName'] . "</b></div>";
			echo "<div>" . $row['Phone'] . "</div>";
			echo "<div>" . "<span>Fax: </span>" . $row['Fax'] . "</div>";
			echo "<div>" . $row['Address'] . "</div>";
			echo "<div>" . $row['City'] . ", " . $row['State'] . ", " . $row['Country'] . "</div><div>" . $row['Zip'] . "</div>";
			echo " " . $row[''] . " ";
			echo "</div><div data-role='collapsible'><h3>Booking Information</h3>";
			echo "<div class='blockContent'><b>Info Here</b><div></div>";
			
			echo "<div data-role='collapsible'><h3>Comments</h3>";
			
			echo "<div class='blockContent'>" . $row['QuestionsComments'] . "</div>";
			echo "</div>";
			

I've tried using create() pageinit() without any success.

Anything you can do to help would be much appreciated.