2 Replies - 811 Views - Last Post: 13 December 2007 - 12:38 AM

#1 didgy58  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 246
  • Joined: 23-October 07

html trouble well i think it is

Posted 21 November 2007 - 03:21 PM

hi guys ive just done a basic search the database page that a user selects options and then the database is searched for the results and they are then pasted onto the screen into a table, the only trouble is sometimes the results wont fit onto the page and i would have thought it would have scrolled all the way down but it doesnt, the results are at the bottom but cant be seem, im using a CSS layout with 6 divs, 1 for wrapper, and the rest for a header, sub header,leftmenu,main and a footer.

the code on my page is as follows, and dont laugh because i realise it wont be up to some of your guys standards but im just learning

thanks

<?php
 
	$newconn=mysql_connect('localhost:3006', 'root', 'root');
	$dbname='danssite';
 	mysql_select_db($dbname);
?>
<html>
<head>
<title> Online Shop</title>
<link rel="stylesheet" type=text/css href="test.css"/>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div id="header">
<center><h1>Welcome to my Online Shop Of Fun</h1></center>
</div>
<div id="subheader">
<form name=menu>
<table align="center" cellspacing="2">
<tr><td><a href="dansshop.php">Mp3 Players</a></td>
<td>Camcorders</td>
<td>Digital Cameras</td>
<td>Mobile Phones</td>
<td>Games Consoles</td>
</table>
</form>
</div>
<div id="leftmenu">
<form name="search" method="post">
<table>
<tr><td>Manufacturer</td>
<td>

<select name="manufacturer">
<option value="">Please Select</option>
<option value='apple'>Apple</option>
<option value='sony'>Sony</option>
<option value='creative'>Creative</option>
</select></td></tr>
<tr><td>Capacity</td>
<td>
<select name="Capacity Range">
<option value="">Please Select</option>
<option >Capacity</option>
<option value="1">1-4 GB</option>
<option value="2">5-16 GB</option>
<option value="3">17-60 GB</option>
<option value="4">61GB +</option>
</select>
</td></tr>
<tr><td>Video Support</td><td>
<select name="Video Support">
<option value="">Please Select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td></tr>
<tr><td>Photo Support</td><td>
<select name="Photo Support">
<option value="">Please Select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select><tr><td>Price Range</td><td>
<select name="Price Range">
<option value="">Please Select</option>
<option value="1">50-100</option>
<option value="2"> 101-150</option>
<option value="3">151-199</option>
<option value="4">200 +</option>
</select>
</td></tr>
<tr><td>Item Colour</td><td>
<select name="Colour">
<option value="">Please Select</option>
<option value=""></option>
<option> 50-100</option>
</select>
</td></tr><tr><td>

<input type=submit style="font-family:'Courier New'" name=search value=Search>
</td></tr>
</table>
</form>
<br>
</div>
<div id="main">
<?PHP
 
//$_POST is an array of all data taken from the form, this includes the search button.
if ($_POST){

//This removes the search button from the post data, the post data is what is sent from the form to where ever you want.
unset($_POST['search']);
 

foreach ($_POST as $po => $st){
	if ($st == ''){
	unset($_POST[$po]);
	}
}
$string = '';
$counter = 0;
//Now we build the SQL search string
foreach ($_POST as $po => $st){ 
	
	//add to statement
	$counter++;
	$string .= $po . '=\'' . $st . '\'';
	
	if ($counter != count($_POST)){
		 //Can be either AND or OR depending on what type of search you want
		 $string .= ' AND ';
	}
	}
 
 
//No that you have the string do the sql database query
$sql = "SELECT * FROM mp3players WHERE " . $string;
$sql_q = mysql_query($sql);

echo "<table  border='1' >";
echo "<tr><th>Manufacturer</th><th>Product</th><th>Capacity GB</th><th>Colour Screen</th><th>Photo Support</th>
<th>Video Support</th><th>Music Battery Life</th><th>Video Battery Life</th><th>Audio Support</th><th>Song Capacity</th><th>Photo Capacity</th><th>Video Capacity</th><th>Colour</th><th>Price </th><th>Pictures</th>
</tr>";
//keeps getting the next row until there is no more to get
while($row=mysql_fetch_array($sql_q)){
	//printing out the contents of each row into a new table
	echo "<tr><td>";
	echo $row['Manufacturer'];
	echo "</td><td>";
	echo $row['Name'];
	echo "</td><td>";
	echo $row['Capacity'];
	echo " GB</td><td>";
	echo $row['Colour_Screen'];
	echo "</td><td>";
	echo $row['Photo_Support'];
	echo "</td><td>";
	echo $row['Video_Support'];
	echo "</td><td>";
	echo $row['PowerM'];
	echo "</td><td>";
	echo $row['PowerV'];
	echo "</td><td>"; 
	echo $row['AudioSupport'];
	echo "</td><td>";
	echo $row['NoOfSongs'];
	echo"</td><td>";
	echo $row['NoOfPhotos'];
	echo "</td><td>";
	echo $row['NoOfVideos'];
	echo "</td><td>";
	echo $row['Colour'];
	echo "</td><td>";
	echo $row['Price'];
	echo "</td><td>";
	echo '<a href="images/'.$row['Picture'].'" rel="lightbox"><img src="images/'.$row['Picture'].'"';
	echo "</td></tr>";
	}
echo "</table>";

while ($sql_f = mysql_fetch_assoc($sql_q)){
//In here is where you want the result to be shown, like a table or something

}
 
}	
?>

</div>
<div id="footer">
here is the footer
</div>
</div>
</body>
</html>



The CSS


#header,#subheader,#footer,#leftmenu{
overflow:hidden;
display:inline-block;
}

#header,#subheader,#footer{
width:100%;}
#subheader{margin-top:-3px;
#leftmenu,#main{float:left;};
#leftmenu{width:19.9%;}
#main{
}

#footer{clear:left;}

#wrapper{
height:100%;
width:100%;
}

#header{
height:30px;
width:100%;

}
#subheader{
height:30px;
width:100%;
}
#footer{
height:30px;
width:100%;

}
#main{
padding-left:0px;
margin-left:20%;
margin-right:100%
height:100%;
background-color:yellow;
}



Is This A Good Question/Topic? 0
  • +

Replies To: html trouble well i think it is

#2 didgy58  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 246
  • Joined: 23-October 07

Re: html trouble well i think it is

Posted 22 November 2007 - 02:06 AM

ok ive sorted out why the table didnt show everything it was a simple overflow hidden thing, but now i have another trouble the fact that the header now doesnt appear at the bottom it appears along side the table which i didnt want to happen

css code

 body {min-width:640px}
#header,#subheader,#leftmenu,#footer {
overflow:hidden;
display:inline-block;
}

#footer {
width:100%;
}
#header,#subheader,#menu,#leftmenu {
float:left;
}
#header {
align:center;
width:100%;

}
#subheader{
width:100%;
}
#main {
display:inline-block;
float:right;
width:80%;
height:100%;
}
#leftmenu
{
width:20%;
}
#footer{
clear:both;
}
h1{
font-family:courier new;
}
td,th{
font-family:courier new;
border-style:none;
text-align:center;
}



and yeah i know the css is bad, if there is a site that somebody could link me to with some good tuturials on how to build a good css as im just starting off really

thanks

dan.
Was This Post Helpful? 0
  • +
  • -

#3 Sormeki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 12-December 07

Re: html trouble well i think it is

Posted 13 December 2007 - 12:38 AM

Well, I'm not actually good with CSS myself, so I can't really help you with the code, but I know a great site for tutorials and such. It helped me hone my HTML skills and it has tutorials for many different languages. Here's a link to the CSS section.
http://www.w3schools...css/default.asp
Hope it helps. I have a friend that is good with CSS, so I'll have him take a look at your code and see if he can figure out what's wrong.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1