<?php

	include "library.php";

	$cxn = start_code( true );

//	$cxn_common = db_common_login();
	

//	$form_name = val( $_GET, "formname" );	

	$search_name = val( $_POST, "search_name" );
	
//	$id = val( $_SESSION, "id" );
	
	
//	$query = "SELECT * FROM screen_definition_main WHERE form_name = 'financial_planning_practices'";
//		
//	$result = run_query( $query, $cxn_common );
//
//	$data = get_row( $result );
//	
//	$table_name = $data['table_name'];


	$query = "SELECT id FROM financial_planning_practices WHERE practice_name like '%".$search_name."%' ORDER BY id LIMIT 1";
		
	$result = run_query( $query, $cxn );		
		
	if (query_num_rows( $result ) >= 1)
	{
		$data = get_row( $result );			
		
		$_SESSION['id'] = $data['id'];			
	}
		
	$nextpage = url_encode( "edit_fp_practice.php", "newrecord", "false" );
		
	header( "Location: ".$nextpage );
	

?>
