Forum Moderators: not2easy
i've been stuck on this one problem for over 2 weeks now, argh!
basically i have a div layout, and i'm trying to include a file using php into one of my divs and i can't seem to make the div expand around the included content. the div has a 1px solid border.
here is the html
<div id="bodycontent">
<div id="bodycontentleft">
<div class="pendingapps"><span class="pendingappstitle">Admin</span></div>
<div class="adminbox">
<div class="include"><?php if(isset($_GET['action'])) { $action = $_GET['action']; include("includes/".$action.".php"); }?></div>
</div>
</div>
<div id="bodycontentright">
<div class="stats"><span class="statstitle">Stats</span></div>
<div class="statsbox"><?php include("includes/stats.php");?></div>
</div>
<br style="clear:both" />
</div>
here is the css
#bodycontent {
background: #ffffff;
width: 877px;
margin-top: 5px;
height: auto;
display: block;
}
#bodycontentleft {
float: left;
width: 580px;
margin-right: 2px;
text-align: left;
height: auto;
}
#bodycontentright {
float: right;
width: 280px;
margin-left: 2px;
text-align: left;
height: auto;
}
.adminbox {
border: 1px solid #FFE8FF;
padding: 5px;
height: auto;
display: block;
}
.pendingapps {
padding: 10px 5px 0px 5px;
background: url(../siteimgs/backgrounds/subheaderpink.jpg) no-repeat;
width: 330px;
height: 30px;
}
.pendingappstitle {
font-size: 12px;
font-weight: bold;
color: #000000;
margin-left: 25px;
}
.pendingappsbox {
border: 1px solid #FFE8FF;
height: auto;
padding: 5px;
}
.stats {
padding: 6px 5px 0px 5px;
background: url(../siteimgs/backgrounds/subheadergrey.jpg) no-repeat;
width: 280px;
height: 30px;
}
.statstitle {
font-size: 12px;
font-weight: bold;
color: #000000;
margin-left: 25px;
}
.statsbox {
border: 1px solid #EFEFEF;
height: auto;
padding: 5px;
}
.include {
height: auto;
width: 570px;
margin: 0 0 10px 0;
}
i know i'm obviously doing something stupid! but i can't figure it out!
thanks in advance for your help!
[edited by: DrDoc at 11:33 pm (utc) on July 8, 2007]
[edit reason] No URLs, thanks. See TOS #13 [WebmasterWorld.com]. [/edit]
Absolutely, i originally started off with <div class="include"> </div> inside the included file and wrapped around the content, but this made no difference.. :/
---
It sounds to me like the content of the include file has been positioned or otherwise floated.
Try making a change to this:
<div class="include"><?php if(isset($_GET['action'])) { $action = $_GET['action']; include("includes/".$action.".php"); }?><br style="clear:both"></div>
--
This was one of the first things i tried when first getting the issue! This also made no difference.
Here is the contents of the include file, maybe this could shed some light..
<?php
//If the user has submitted the form
if (isset($_POST['submit'])) {
if (rebelapps_db()) {
//Store submitted form data in variables
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$age = $_POST['age'];
$city = $_POST['city'];
$state = $_POST['state'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$creditname = $_POST['creditname'];
$usrname = $_POST['usrname'];
$prefcontact = $_POST['prefcontact'];
$contact = $_POST['contact'];
$camera = $_POST['camera'];
$additional = $_POST['additional'];
$studio = $_POST['studio'];
//Define SQL query
$query = "INSERT INTO photographers SET
firstname = '".mysql_real_escape_string($firstname)."',
lastname = '".mysql_real_escape_string($lastname)."',
age = '$age',
city = '".mysql_real_escape_string($city)."',
state = '$state',
email = '$email',
gender = '$gender',
creditname = '".mysql_real_escape_string($creditname)."',
usrname = '".mysql_real_escape_string($usrname)."',
prefcontact = '$prefcontact',
contact = '".mysql_real_escape_string($contact)."',
camera = '".mysql_real_escape_string($camera)."',
additional = '".mysql_real_escape_string($additional)."',
Studio = '$studio'";
//Attempt to query the database
//If unsuccessful display error message
if (@mysql_query($query)) {
echo "<span class=\"wannabearebeltext\">New photographer added!<br><br>";
} else {
echo "<p>Unable to add the photographer to the database: " . mysql_error() . ".</p>";
}
//Display links to view or add another record
}
} else {
//If the user hasn't submitted the form
?>
<div id="photodetails">
<form name="form1" method="POST" action="admin.php?action=photodetails" class="form">
<fieldset>
<legend>Photographer Details</legend>
<br><br>
<span class="blacktextbold">First name</span><br><br>
<input name="firstname" type="text" class="smallformboxpink" id="firstname" size="30"><br><br>
<span class="blacktextbold">Last Name</span> <br><br>
<input name="lastname" type="text" class="smallformboxpink" id="lastname" size="30"><br><br>
<span class="blacktextbold">Credit Name</span> <br><br>
<span class="txtbox">This is what your photographic services will be credited as</span><br>
<input name="creditname" type="text" class="smallformboxpink" id="creditname" size="30"><br><br>
<span class="blacktextbold">Profile Username </span><br>This will be your login username (all one word) <br>
<span class="txtbox"><input name="usrname" type="text" class="smallformboxpink" id="usrname" size="30"><br><br.
<span class="blacktextbold">Age</span> <br><br>
<input name="age" type="text" class="smallformboxpink" id="age" size="2"><br><br>
<span class="blacktextbold">Gender</span> <br><br>
<select name="gender" class="smallformboxpink" id="gender">
<option value="Female" selected>Female</option>
<option value="Male">Male</option>
</select><br><br>
<span class="blacktextbold">City</span><br><br>
<input name="city" type="text" class="smallformboxpink" id="city"><br><br>
<span class="blacktextbold">State</span><br><br>
<select name="state" class="smallformboxpink" id="state">
<option value="Choose a State.." selected>Choose a State..</option>
<option value="NSW">NSW</option>
<option value="VIC">VIC</option>
<option value="QLD">QLD</option>
<option value="SA">SA</option>
<option value="WA">WA</option>
<option value="NT">NT</option>
<option value="TAS">TAS</option>
<option value="ACT">ACT</option>
</select><br><br>
<span class="blacktextbold">Prefered Contact Method </span><br><br>
<select name="prefcontact" class="smallformboxpink" id="prefcontact">
<option value="Choose a Method.." selected>Choose a Method..</option>
<option value="Myspace">Myspace</option>
<option value="Email">Email</option>
<option value="Phone">Phone</option>
</select><br><br>
<span class="blacktextbold">Contact Details</span><br><br><br>
<span class="txtbox">Please enter the details the girls will need to contact you. Ie. email address, web address, (include <strong>http://</strong> if web address)</span> <br>
<input name="contact" type="text" class="smallformboxpink" id="contact" size="40"><br><br>
<span class="blacktextbold">Camera Type </span><br><br>
<input name="camera" type="text" class="smallformboxpink" id="camera" size="40"><br><br>
<span class="blacktextbold">Studio Access </span><br><br>
<select name="studio" class="smallformboxpink" id="studio">
<option value="No" selected>No</option>
<option value="Yes">Yes</option>
</select><br><br>
<span class="blacktextbold">Additional Info </span><br><br>
<span class="txtbox">Use this text field to add any requirements, or info you feel the girls will need to know prior to booking you.</span><br>
<textarea name="additional" cols="40" rows="5" class="smallformboxpink" id="additional"></textarea><br><br>
<span class="blacktextbold">Email address </span><br><br>
<input name="email" type="text" class="smallformboxpink" id="email" size="30"><br><br>
<input type="submit" name="submit" value="Submit info"><br><br>
<br>
</fieldset>
</form>
</div>
<?php
}
?>
---
("id="photodetails"" is just an id and has no css applied to it yet)
While trying to narrow down what the problem could be, i removed the php include and just pasted a bunch of text within the "adminbox" div and it expanded perfectly. So this led me to a week or so of making changes to the actual include, and the "include" div, but nothing seemed to work.
I'm at a loss.
my form which resides inside the include has a class .form and that didnt have a height specified, so i put height:auto and wouldn't you know... it fixed the problem.
strange though, before i applied a class to the form it was still overflowing.. i didn't realise that forms needed a height property in order to avoid spilling out over a div.. you learn something new everyday!
thanks for your help!