Ok I have been working on writting php now i am at a point to where i am trying to connect it all together. My knowledge is limited thats why i am assking for help. I have been able to create a web form page combining html and php elements. now i am trying to apply that same principles to more of a template base here is what i have done
<?php include('global.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Child Care Search</title>
<link rel="stylesheet" href="ccl.css" type="text/css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<div align="left">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" class="top" style="width: 753px"><img border="0" src="Logo.gif" width="460" height="90"> </td>
<div align="center"><?php
if ($error)
{
echo '<div class="fail">'.$error.'</div>';
}
?>
<table border="0" cellspacing="0" cellpadding="0" class="celloutline" width="500">
<form method="POST" action="search_results.php">
<tr>
<td height="35" colspan="6" align="center" valign="middle" bgcolor="#edf4fb" class="borderBottom SubTitle">SEARCH LISTINGS</td>
</tr>
<tr>
<td colspan="6"><table width="100%" cellpadding="0" cellspacing="0">
</table>
<td width="290"><select name="Features" class="field" id="Features">
<option value="" selected>-- SELECT FEATURE --</option>
<?php
@ $results = mysql_query('select * from Features order by Feature ASC');
@ $num = mysql_num_rows($results);
for ($i=0;$i<$num;$i++)
{
@ $data = mysql_fetch_array($results);
echo '
<option value="'.$data['FeatureID'].'">'.$data['Feature'].'</option>';
}
?>
</select></td>
</tr> */?>
<tr>
<td align="right" valign="middle" nowrap class="largeText"><strong>Postal Code</strong></td>
<td><input name="Zip" type="text" class="field" id="Zip" value="<?php echo $_POST['Zip']; ?>" size="10"></td>
</tr>
<tr>
<tr>
[COLOR="Cyan"]<td width="190" align="right" valign="middle" nowrap bgcolor="#F2F8FB" class="largeText borderTop borderBottom"><strong>Primary Feature</strong></td>
<td nowrap="nowrap" bgcolor="#F2F8FB" class="largeText borderTop borderBottom"><?php
@ $results = mysql_query('select * from Features order by Feature ASC');
@ $fnum = mysql_num_rows($results);
for ($i=0;$i<$fnum;$i++)
{
@ $fdata = mysql_fetch_array($results);
echo '<label><input type="checkbox" name="feature[]" id="feature'.$i.'" value="'.$fdata['FeatureID'].'" />'.$fdata['Feature'].'</label><br>';
}
?></td>
</tr>[/COLOR]
<tr>
<td width="190" height="45" valign="middle" bgcolor="#edf4fb" class="borderTop"> </td>
<td height="45" align="left" valign="middle" bgcolor="#edf4fb" class="borderTop"><input name="Action" type="submit" class="button" value="Search Listings"> </td>
</tr>
</table></td>
</tr>
</form>
</table>
<p> </p>
</div><table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td align"left" width="100" class="borderTop text"> </td>
<?php
@ $query = 'select * from Results LEFT JOIN Licensure on (Results.LicensureID=Licensure.LicensureID) where Results.Featured="1" order by RAND() limit 8';
@ $results = mysql_query($query);
@ $num = ceil(mysql_num_rows($results)/2);
for ($i=0;$i<$num;$i++)
{
@ $data = mysql_fetch_array($results);
echo '
<tr style="background:#';
if ($i%2==0)
{
echo 'edf4fb';
}
else
{
echo 'ffffff';
}
echo '">
<td align"left" width="100" class="text"><a href="listing_detail.php?id='.$data['Key'].'&'.$data['ListName'].'" class="text" alt="'.$data['ListName'].'" title="'.$data['ListName'].' - '.ucwords(strtolower($data['City'])).', '.$data['State'].'" style="padding:1px;"><img src="images/listings/'.$data['Photo1'].'" border="0" align="left" valign="bottom" hspace="3" width="100" class="borderLightBlue" onmouseover="className=\'borderOn\';" onmouseout="className=\'borderLightBlue\';"></a></td>
<td class="text" valign="top"><a href="listing_detail.php?id='.$data['Key'].'&'.$data['ListName'].'" class="largeText" alt="'.$data['ListName'].'" title="'.$data['ListName'].' - '.ucwords(strtolower($data['City'])).', '.$data['State'].'"><strong>'.$data['ListName'].'</strong></a><br>Location: <strong>'.ucwords(strtolower($data['City'])).', '.$data['State'].'</strong><br>Licensed: <strong>'.$data['Licensure'].'</strong><br>';
if ($data['Phone'])
{
echo 'Phone: <strong>'.$data['Phone'].'</strong>';
}
elseif ($data['eMail'])
{
echo 'Email: <a href="mailto:'.$data['eMail'].'"><strong>'.$data['eMail'].'</a></strong>';
}
echo '</td>
<td> </td>';
@ $data = mysql_fetch_array($results);
if (empty($data['ListName']))
{
echo '<td> </td>
<td> </td>
';
}
else
{
echo '
<td align"left" width="100" class="text"><a href="listing_detail.php?id='.$data['Key'].'&'.$data['ListName'].'" class="text" alt="'.$data['ListName'].'" title="'.$data['ListName'].' - '.ucwords(strtolower($data['City'])).', '.$data['State'].'" style="padding:1px;"><img src="images/listings/'.$data['Photo1'].'" border="0" align="left" valign="bottom" hspace="3" width="100" class="borderLightBlue" onmouseover="className=\'borderOn\';" onmouseout="className=\'borderLightBlue\';"></a></td>
<td class="text" valign="top"><a href="listing_detail.php?id='.$data['Key'].'&'.$data['ListName'].'" class="largeText" alt="'.$data['ListName'].'" title="'.$data['ListName'].' - '.ucwords(strtolower($data['City'])).', '.$data['State'].'"><strong>'.$data['ListName'].'</strong></a><br>Location: <strong>'.ucwords(strtolower($data['City'])).', '.$data['State'].'</strong><br>Licensed: <strong>'.$data['Licensure'].'</strong><br>';
if ($data['Phone'])
{
echo 'Phone: <strong>'.$data['Phone'].'</strong>';
}
elseif ($data['eMail'])
{
echo 'Email: <a href="mailto:'.$data['eMail'].'"><strong>'.$data['eMail'].'</a></strong>';
}
echo '</td>
</tr>';
}
}
?>
</table>
<div align="left">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle" class="footerbar">Copyright <a href="editor/login.asp" target="_self">©</a><?php echo date('Y'); ?> Platinum Business Alliance,
Inc. |
<?php include('navbar.php'); ?></td>
</tr>
</table>
</div>
</body>
</html>
I have Changed the Color of code that i am trying to convert into a template style format. Here is what i have came up with. code for the php file
<?php
if(ereg("advancedsearch.php",$_SERVER['PHP_SELF'])){
@header("Location:index.php");
die("<script>window.location='index.php';</script>"); //js redirect backup
}
//Fetch Features
$sql = "select * from Features order by Feature ASC";
$result = $mysql->exSql($sql) or die($mysql->debugPrint());
while($row = mysql_fetch_assoc($result)){
if(isset($_GET['feature']) && $_GET['feature'] != ""){
if(is_array($_GET['feature'])){
if(in_array($row['featureid'],$_GET['feature'])){
$row['selected'] = "selected";
}
}else{
$row['selected'] = ($_GET['feature'] == $row['Featureid']?"selected":"");
}
}
$xtpl->assign('row',$row);
$xtpl->parse('main.advancedsearch.feature');
}
?>
Now for the Html Side
<!-- BEGIN: advancedsearch -->
<div class="storybox">
<div class="header">Advanced Search</div>
<div class="body">
<div class="directions">All fields are optional. Leave any field blank to include all.</div>
<form action="search.php" method="get" id="advancedsearch">
<table class="formtable" cellpadding="3" cellspacing="0" width="100%">
<tr>
<th colspan="2">Listing Information</th>
</tr>
<tr>
<td class="column">Features</td>
<td class="row">
<input type="checkbox" name="feature[]" id="feature'.$i.'" value="'.$fdata['FeatureID'].'" />
<!-- BEGIN: feature -->
<option value="{row.id}" {row.selected}>{row.title}</option>
<!-- END: feature -->
</tr>
<tr>
<td class="column">Keyword</td>
<td class="row">
<input type="text" name="keyword" size="30" value="{PHP._GET.keyword}" />
</td>
</tr>
<tr>
<td class="column"> </td>
<td class="row"><input type="submit" value="Search Listings" /></td>
</tr>
</table>
</form>
<a href="#top">Top of Page</a>
</div>
</div>
<!-- END: advancedsearch -->
when i swith the form style to multiple it works but now with a check box. any help with teaching me what i did wrong is appreciated.