I am creating a search form for a packaging database and I have used CSS to style the HTML form that calls to the PHP page. I want to be able to style all the results from the PHP page using the same kind of CSS that styles the search form, as the PHP continues to echo the results as separate elements I want all of them to be displayed in separate little boxes. Is it as simple as I think it is e.g. just surrounding the PHP with tags? As I am trying that currently but it doesn't seem to work.
<body>
<?php
$con = mysql_connect ("localhost", "root", "");
mysql_select_db ("delyn_db", $con);
if (!$con)
{
die ("Could not connect: " . mysql_error());
}
$descrip = mysql_real_escape_string($_POST['descrip']);
$depth = mysql_real_escape_string($_POST['depth']);
$varWidth = mysql_real_escape_string($_POST['traywidth']);
$varHeight= mysql_real_escape_string($_POST['trayheight']);
$varRange = mysql_real_escape_string($_POST['trayrange']);
$varType = mysql_real_escape_string($_POST['traytype']);
$varShape = mysql_real_escape_string($_POST['trayshape']);
$varImage = mysql_real_escape_string($_POST['imagename']);
if (isset($varHeight) && !empty($varHeight)) {
$low = ($varHeight."00");
$high = ($varHeight."99");
} else {
$low = ("000");
$high = ("999");
}
if (isset($varWidth) && !empty($varWidth)) {
$min = ($varWidth."00");
$max = ($varWidth."99");
} else {
$min = ("000");
$max = ("999");
}
$sql = "SELECT * FROM delyn WHERE
description LIKE '%".$descrip."%'
AND trayrange LIKE '%".$varRange."%'
AND traytype LIKE '%".$varType."%'
AND trayshape LIKE '%".$varShape."%'
AND traywidth BETWEEN '".$min."' AND '".$max."'
AND trayheight BETWEEN '".$low."' AND '".$high."' ";
?>
while ($row = mysql_fetch_array($r_query))
{
echo '<p class="results">';
echo '<br /><img src=" '. $row['imagename'] . '" width="120" length="50">';
echo '<br /><strong> Tool Code: </strong> '. $row['toolcode'];
echo '<br /><strong> Description: </strong> '. $row['description'];
echo '<br /><strong> Tray range: </strong> '. $row['trayrange'];
echo '<br /><strong> Tray type: </strong> '. $row['traytype'];
echo '<br /><strong> Tray size: </strong> '. $row['traysize'];
echo '<br /><strong> Tray shape: </strong> '. $row['trayshape'] . '<br />' . '<br />' . '</p>';;
}
if (mysql_num_rows($r_query) <= 0){
echo 'No results match your search, please try again';
}
?>
</body>
CSS (For the HTML form, I want the same attributes for the Form div tag to work for the results):
@charset "UTF-8";
/* CSS Document */
body {
}
.results {
width: 190px;
padding: 10px;
background: #E8CF24;
overflow:auto;
display:block;
font-family: Verdana, Geneva, sans-serif;
font-size: 11px;
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
Now EDITED.