[insert_php]
/*
* Testing configuration
*/
define(‘ENVIR’,0);
define(‘ENVIR_DEV’,0);
define(‘ENVIR_LIVE’,1);

/*
* Data base credentials (replace this with your db credentials)
*/
define(‘DB_USER’,’asti1753_wp’);
define(‘DB_PWD’,’#Asti101′);
define(‘DB_HOST’,’localhost’);
define(‘DB_NAME’,’asti1753_wp’);

/*
* Connect to database
*/
try {
$db = new PDO(‘mysql:host=’.DB_HOST.’;dbname=’.DB_NAME,DB_USER,DB_PWD);
} catch(PDOExeption $e) {

if(ENVIR == ENVIR_DEV) {
echo ‘

‘,$e->getMessage(),’

‘;
}

echo ‘

Unable to connect to database

‘;
exit;
}

/*
* Template variables
*/
$tpl = array(
‘filter’=>array(
‘#action’ => $_SERVER[‘SCRIPT_NAME’]
,’#method’ => ‘get’
,’org_name’ => array(
‘#values’=>array(
array(‘value’=>”,’label’=>’All’)
)
)
)
,’grid’=>array(
‘asti_organization’=>array()
)
);

/*
* Populate form filter last name options
*/
$stmt = $db->query(‘SELECT org_name FROM asti_organization GROUP BY org_name ORDER BY org_id ASC’);

if($stmt === false) {
echo ‘

Unable to populate required data to build page.

‘;
exit;
}

while($row=$stmt->fetch(PDO::FETCH_ASSOC)) {
$tpl[‘filter’][‘org_name’][‘#values’][] = array(
‘label’ => $row[‘org_name’]
,’value’ => $row[‘org_name’]
,’selected’ => isset($_GET[‘filter’],$_GET[‘filter’][‘org_name’]) && $_GET[‘filter’][‘org_name’] == $row[‘org_name’]
);
}

/*
* Populate user grid
*/
$stmt = $db->prepare(sprintf(
‘SELECT org_name,address FROM asti_organization %s’
, isset($_GET[‘filter’],$_GET[‘filter’][‘org_name’]) && !empty($_GET[‘filter’][‘org_name’])?’WHERE org_name = :org_name’:”
));

if($stmt === false) {
echo ‘

Unable to populate required data to build page.

‘;
exit;
}

$stmt->execute(isset($_GET[‘filter’],$_GET[‘filter’][‘org_name’]) && !empty($_GET[‘filter’][‘org_name’])?array(‘:org_name’=>$_GET[‘filter’][‘org_name’]):array());

while($row=$stmt->fetch(PDO::FETCH_ASSOC)) {
$tpl[‘grid’][‘asti_organization’][] = $row;
}

/*
* Start template output
*/
[/insert_php]

Organizations Approved by ASTI


American Service to India (ASTI) works in partnership with programs in India whose goal is to train men and women to become productive individuals. Though ASTI recognizes that help is needed in many areas, it has chosen to work in the fields of education and medical assistance through

partnership with effective rehabilitative programs. These programs engender economic independence and self-respect for the less fortunate in order that they may fashion productive lives for themselves and their families. The organizations are listed by state and types of programs;

i.e. schools, orphanages, hospitals, clinics, etc. Included is the Ramakrishna Sarada Mission,
The Ramakrishna Mission, and non-government organizations (ngos) Many of the missions offer multiple programs for the poor.

Organizations

[insert_php]
if(!empty($tpl['grid']['asti_organization'])) {
foreach($tpl['grid']['asti_organization'] as &$org) {
printf(
'

'
,htmlentities($org['org_name'])
,htmlentities($org['address'])
);
}
} else {
echo '

';
}
[/insert_php]

Organization
Name Address
%s %s
No names available