Same CSS Displays Differently On Two Pages?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
faile486
Forum Newbie
Posts: 15
Joined: Wed Nov 18, 2009 8:12 pm

Same CSS Displays Differently On Two Pages?

Post by faile486 »

I'm at my wits end here. I've got a project due on Friday of this week that's worth a significant portion of my grade. I've worked really hard on it now for over two months. It uses a variety of different technologies: xhtml, CSS, Javascript, PHP, and mySQL. All the coding stuff seems to be working just fine (finally!!). Here's the issue:

The CSS displays fine in Firefox (big surprise, right?) and it displays fine on SOME pages of IE. I've got browser-specific stylesheets.
Two of the pages in question, called form.php and modify.php display the same xhtml code. The only difference is that one is for adding a new entry to the database, and the other is for modifying an existing entry. The modify.php page has pre-populated form fields.

It also displays differently than the form.php file, in the same browser (IE8). I don't understand why. The two pages are identical in FF, and the form.php file is almost identical in both FF and IE.

I've been trying to fix this myself for almost a week now, but I'm running out of time. Can anyone help?

I can post code, or give links if requested.
_64k
Forum Newbie
Posts: 16
Joined: Thu Nov 12, 2009 8:52 am

Re: Same CSS Displays Differently On Two Pages?

Post by _64k »

post a link or code, I'll help.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Same CSS Displays Differently On Two Pages?

Post by pickle »

Do the pages validate?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Same CSS Displays Differently On Two Pages?

Post by kaszu »

Pickle is right, it sounds like you have unclosed tag somewhere or 'value' is injecting html into DOM (unescaped values?). Validation should show the problem.
faile486
Forum Newbie
Posts: 15
Joined: Wed Nov 18, 2009 8:12 pm

Re: Same CSS Displays Differently On Two Pages?

Post by faile486 »

All pages validate. The CSS on the two pages validates, other than the few CSS3 elements I'm using to style the file input boxes. Since those are the same in both documents, I would hope that wouldn't be the issue.

I've checked for unclosed tags, and have been unable to find any myself, on top of using the W3C validator. I'm including the code in the next post. I've removed the database connection info, since I'd rather not have that broadcast to the internet, but the code is the same otherwise = )
faile486
Forum Newbie
Posts: 15
Joined: Wed Nov 18, 2009 8:12 pm

Re: Same CSS Displays Differently On Two Pages?

Post by faile486 »

IE CSS;

Code: Select all

 
@charset "utf-8";
/* CSS Document */
@charset "utf-8";
/* CSS Document */
 
* {margin: 0; padding: 0;} 
 
body {
    font-family: Verdana, Geneva, sans-serif;
    background-color: #436777;
    padding: 0px;
    margin: 0px;
    text-align: center;
 
}
 
h1, h2, h3, h4, h5 {
    font-family: Georgia, "Times New Roman", Times, serif;
    color: #0b879f;
    padding: 5px;
}
 
#container {
    position: relative;
    background-color: #0b87a1;
    width: 860px;
    margin: 0 auto;
    }
 
#content {
    width: 780px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0px;
    margin-bottom: 0px;
    background-color: #fff;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-top: 0px;
    text-align: left;
}
 
#content ul {
    margin-left: 25px; 
}
#masthead {
    width: 780px;
    text-align: center;
    padding: 0px;
    background-color: #fff;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0px;
    margin-bottom: 0px;
    padding-bottom: 10px;
}
#navbar {
    margin-top: 5px;
    margin-bottom: 0px;
    padding-top: 10px;
    padding-bottom: 5px;
    border-bottom: solid 2px #e8a438; 
    border-top: solid 2px #e8a438; 
    text-align: center;
    color: #e8a438;
}
 
#context_navbar {
    text-align: center;
    color: #e8a438;
}
 
#footer {
    border-top: solid 2px #e8a438;
    width: 780px;
    background-color: #fff;
    text-align: center;
    font-size: 75%;
    font-style: italic;
    margin-left: auto;
    margin-right: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    height: 50px;
}
 
a {
    color: #e8a438;
    font-weight: bold;
    text-decoration: none;
}
 
a:hover {
    color: #e8a438;
    font-weight: bold;
    text-decoration: underline;
}
 
hr {
    margin-top: 5px;
    margin-bottom: 5px;
    color: #0b879f;
}
 
img {
    border: solid 2px black;
    margin: 5px;
}
 
table {
    border: dashed 2px #0b879f;
    margin-right: auto;
    margin-left: auto;
}
 
table table {
    border: none;
}
 
.rating {
    font-weight: bold;
    border-left: dashed 2px #0b879f;
    vertical-align: top;
    text-align: center;
    text-transform: uppercase;
}
 
.picture {
    border-right: dashed 2px #0b879f;
}
 
.picture_table {
    border: none;
    width: 780px;
}
 
.nav_image {
    border: none;
    vertical-align: middle;
}
 
.view_pics {
    display:block; 
    position:absolute; 
    padding: 0px;
    margin: 0px;
    border-style: solid; 
    background-color: white; 
    height: 225px;
    width: 300px;
    z-index: 1;
}
 
.nomargin {
    padding: 0px;
    margin: 0px;
    border: none;
}
 
input, select, textarea, file {
    border: 2px solid #0b879f;
    margin: 5px;
}
 
.radio {
    margin: 5px;
    border: none;
}
 
select {
    padding-left: 2px;
}
 
textarea {
    width: 98%;
}
 
.button, a.button {
    border: 2px solid #e8a438;
    background-color: #fff;
    padding: 2px;
    color: #0b879f;
    font-weight: bold;
    
}
 
a.button {
    position: relative;
    top: -11px;
    font-size: 12px;
    padding: 4px;
}
 
a:hover.button {
    text-decoration: none;
}
 
fieldset, legend {
    border: 2px solid #0b879f;
    padding: 5px;
}
 
legend {
    font-weight: bold;
    color: #0b879f;
    margin-top: 10px;
}
 
.file {
    border: none;
}
 
.ameny {
    float: right;
    width: 430px;
}
 
.ieameny {
    float: right;
    width: 425px;
}
 
.basics {
    float: left;
    width: 325px;
    height: 422px;
    margin-bottom: 50px;
}
 
.basics label {
    float: left;
}
 
.basics input {
    float: right;
}
 
#utilities {
    margin-top: 30px;
}
 
div#left {
    float: left;
}
 
div#left hr {
    width: 183px;
}
 
div#right {
    float: right;
}
 
.selects {
    float: right;
    margin-right: 105px;
}
.labels {
    float: left;
    text-align: right;
}
 
/*label {
    margin-bottom: 10px;
    margin-left: 0px;
    margin-right: 0px;
}*/
 
.noborder {
    border: none;
}
 
.border {
    border: solid 2px black;
}
 
.cellBorder {
    border: none;
    border-bottom: 2px solid #0b879f;
    font-weight: bold;
    padding-bottom: 2px;
}
 
/************************************************************TEMPLATE CSS*********************************************************/
#template {
    padding: 0px;
    padding-top: 10px;
    padding-bottom: 10px;
    border: 2px dashed #0b879f;
    float: left;
}
 
#toprow {
    font-weight: bold;
}
 
#toprow span {
    margin-left:40px;
    margin-right:40px;
}
 
#template hr {
    text-align: center;
    margin-left:auto;
    margin-right: auto;
    width: 98%;
}
 
#leftcol {
    float:left;
    width: 185px;
    margin-left: 5px;
    padding-right: 5px;
}
 
#leftcol h2 {
    font-family: Verdana, Geneva, sans-serif;
    color: #000;
    font-size: 16px;
    font-weight: bold;
    padding-bottom: 0px;
}
 
#leftcol p {
    padding-left: 5px;
}
 
#midcol {
    float: left;
    width: 310px;
    padding-right: 8px;
    border-right: 2px solid #0b879f;
    border-left: 2px solid #0b879f;
    height: 100%;
}
#img_container {
    position: relative;
    top: 5px;
    left: 5px;
    height: 250px;
}
 
#rightcol {
    float: right;
    width: 350px;
    padding-left: 5px;
}
 
#ratings table{
    border: none;
    text-align: left;
    margin: 0px;
    padding-left: 20px;
}
 
#rightcol table{
    border: none;
}
 
faile486
Forum Newbie
Posts: 15
Joined: Wed Nov 18, 2009 8:12 pm

Re: Same CSS Displays Differently On Two Pages?

Post by faile486 »

Form.php - this file displays correctly.

Code: Select all

 
<?php
 
//I didn't write the scripts for uploading images, but I did edit a bit of them.  
//I've used it before and can't find who the original credit should go to.
 
//This include is used to determine the rating of the apartments. - KM 
include("includes/rating.php");
 
$upload_image_limit = 21; // How many images you want to upload at once?
$upload_dir         = ""; // default script location, use relative or absolute path
  
 
//This function reads the extension of the file. It is used to determine if the file is an image by checking the extension.
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 
//This variable is used as a flag. The value is initialized with 0 (meaning no error  found) and it will be changed to 1 if an errro occures.  
//If the error occures the file will not be uploaded.
 $errors=0;
//checks if the form has been submitted - KM
 if(isset($_POST['Submit'])) 
 {
     $con = mysql_connect();
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("kendramo_apartment", $con);
//I want to be able to go back and check each apartment listing after it's uploaded.  Setting the rating to 0 means new listings always show up at the bottom of the page. -KM  
    $rating_total = 0;
//SQL statments for inserting all values into the database - KM
    $sql="INSERT INTO apartments (address, c_name, phone, email, bed, bath, distance, price, sqFeet, type, specials, notes, rating, dw, laundry, fridge, stove, microwave, floor1,                                floor2, counter, alarm, appliance, air, parking, heat, pets, outside, url, water, power, rating_total )
    VALUES
    (
     '$_POST[address]',
     '$_POST[c_name]',
     '$_POST[phone]',
     '$_POST[email]',
     '$_POST[bed]',
     '$_POST[bath]',
     '$_POST[distance]',
     '$_POST[price]',
     '$_POST[sqFeet]',
     '$_POST[type]',
     '$_POST[specials]',
     '$_POST[notes]',
     '$_POST[rating]',
     '$_POST[dw]',
     '$_POST[laundry]',
     '$_POST[fridge]',
     '$_POST[stove]',
     '$_POST[microwave]',
     '$_POST[floor1]',
     '$_POST[floor2]',
     '$_POST[counter]',
     '$_POST[alarm]',
     '$_POST[appliance]',
     '$_POST[air]',
     '$_POST[parking]',
     '$_POST[heat]',
     '$_POST[pets]',
     '$_POST[outside]',
     '$_POST[url]',
     '$_POST[water]',
     '$_POST[power]',
     '$rating_total'
     )";
    
    if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
        $last_id = mysql_insert_id ();
        echo "1 record added. <br />";
 
//Sets an unique upload directory for each apartment listing - KM
$upload_dir = 'images/' . $last_id . '/';
 
//Checks to see if the directory exists.  If not, creates it. - KM
if (!file_exists($upload_dir))
    {
        if (mkdir($upload_dir, 0777))
        {
            echo "1 directory created.";
        }
        else
        {
            echo "error.";
        }
    }
 
//Uploads the files
foreach($_FILES as $k => $v){ 
 
    $img_type = "";
//If there are no errors, they are a specific type, and they are the correct size, upload them.
    if( !$_FILES[$k]['error'] && preg_match("#^image/#i", $_FILES[$k]['type']) && $_FILES[$k]['size'] < 1000000){
//sets the correct file extension
            $img_type = ($_FILES[$k]['type'] == "image/jpeg") ? ".jpg" : $img_type ;
            $img_type = ($_FILES[$k]['type'] == "image/gif") ? ".gif" : $img_type ;
            $img_type = ($_FILES[$k]['type'] == "image/png") ? ".png" : $img_type ;
//Sets a unique name for each image, cosisting of the aptID, _image, the number the image is in the list, and the file extension. - KM
            $image_name=$last_id . '_' . $k . $img_type;
//Sets the location of the image.  This value is uploaded into the database. - KM           
            $newname=$filepath.$image_name;
 
            $img_rname = $image_name;
    
            $img_path = $upload_dir.$img_rname;
 
            copy( $_FILES[$k]['tmp_name'], $img_path ); 
            $feedback .= "Image and thumbnail created $img_rname<br />";
 
//The SQL statement for uploading the image information into the database. - KM
 
$sql = "INSERT INTO images (aptID, location)
    VALUES
    (
     '$last_id',
     '$newname'
     )";
 
    if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
        echo "1 image added. <br />";
}
        }
        mysql_close($con);
 
//If no errors registred, print the success message
 if(isset($_POST['Submit']) && !$errors) 
 {
    echo "<h1>Entry submited sucessfully!</h1>";
 }
echo '<meta http-equiv="refresh" content="2;URL=index.php">'; 
 }
 ?>
 
 <!-- ********************************************************************    FORM    ******************************************************************** -->
<!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=utf-8" />
<title>Add A New Listing</title>
<script language="javascript" type="text/javascript" src="scripts/browserdetect.js">
</script>
<style type="text/css">
/* STYLING FOR UPLOAD/SELECTS */
.upload {
    position:relative;
    width: 230px;
    float: left;
}
 
.realupload {
    position:absolute;
    top:0;
    left:0;
    opacity:0;
    -moz-opacity:0;
    filter:alpha(opacity:0);
    z-index:2; 
    width:74px;
    border: solid;
}
 
.fakeupload {
    background:url(images/nav_images/browse.jpg) no-repeat 100% 50%;
}
 
input.fakeupload {
    background: none;
    width:140px;
    height: 22px;
}
 
</style>
</head>
<body>
<?php include ("includes/header.html"); ?>
<div id='content'>
<div id='context_navbar'>
<a href='#info'>Basic Info</a> | 
<a href='#amenities'>Ameneties</a> | 
<a href='#utilities'>Utilities</a> | 
<a href='#extra'>Extra Info</a> | 
<a href='#pictures'>Pictures</a>
</div>
<br /><br />
 
<form name="newad" method="post" enctype="multipart/form-data"  action="" class="form">
<fieldset class="basics">
<legend id='info'>Basic Information</legend>
<label for="address">Address: </label><input type="text" name="address" id="address" /> <br />
<label for="c_name">Contact Name: </label><input type="text" name="c_name" id="c_name" /> <br />
<label for="phone">Contact Phone: </label><input type="text" name="phone" id="phone" /> <br />
<label for="email">Contact Email: </label><input type="text" name="email" id="email" /> <br />
<label for="distance">Distance: </label><input type="text" name="distance" id="distance" /><br  />
 
<label for="price">Price: &nbsp; &nbsp; </label><input type="text" name="price" id="price" /> <br />
<label for="sqFeet">Square Feet: </label><input type="text" name="sqFeet" id="sqFeet" /> <br />
<label for="type">Least Type: </label><input type="text" name="type" id="type" /> <br />
<label for="url">Original Listing:</label> <input type="text" name="url" id="url" /><br />
<br /><br /><br /><br />
<div class="labels">
<p>
<label for="rating" class="label">Rating:</label> <br />
<label for="bed" class="label">Bedrooms:</label> <br />
<label for="bath" class="label">Bathrooms: </label> <br />
</p>
</div>
<div class="selects">
<select id="rating" name="rating" style="width: 40px;">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
    </select><br />
 
<select id="bed" name="bed" style="width: 40px;">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
         </select> <br />
 
<select id="bath" name="bath" style="width: 40px;">
            <option value="1">1</option>
            <option value="1.5">1.5</option>
            <option value="2">2</option>
            <option value="2.5">2.5</option>
            <option value="3">3</option>
         </select>
</div>
</fieldset>
<fieldset class='ameny'>
<legend id="amenities">Ameneties</legend>
Laundry: <select id="laundry" name="laundry" style="width: 230px;">
            <option value="1">Washer/Dryer In Unit</option>
            <option value="2">Washer/Drryer Hookups In Unit</option>
            <option value="3">Laundry On Premesis</option>
            <option value="4">No Laundry</option>
                    </select><br />
 
Flooring: <select id="floor1" name="floor1" style="width: 100px;">
            <option value="1">Hardwood</option>
            <option value="2">Tile</option>
            <option value="3">Carpet</option>
            <option value="4">Linolium</option>
        </select>
 <select id="floor2" name="floor2" style="width: 100px;">
            <option value="1">Hardwood</option>
            <option value="2">Tile</option>
            <option value="3">Carpet</option>
            <option value="4">Linolium</option>
        </select> <br />
<hr />
<div id="left">
Dishwasher <br />
<input type="radio" name="dw" id="dw" value="1" class="radio" /> <label for="dw">Yes</label> 
<input type="radio" name="dw" id="nodw" value="0" class="radio" /> <label for="nodw">No</label> <br />
<hr />
Refrridgerator <br />
<input type="radio" name="fridge" id="fridge" value="1" class="radio" /> <label for="fridge">Yes</label>
<input type="radio" name="fridge" id="nofridge" value="0" class="radio" /> <label for="nofridge">No</label> <br />
<hr  />
Stove/Oven <br />
<input type="radio" name="stove" id="stove" value="1" class="radio" /> <label for="stove">Yes</label>
<input type="radio" name="stove" id="nostove" value="0" class="radio" /> <label for="nostove">No</label> <br />
<hr />
Microwave <br />
<input type="radio" name="microwave" id="microwave" value="1" class="radio" /> <label for="microwave">Yes</label>
<input type="radio" name="microwave" id="nomicrowave" value="0" class="radio" /> <label for="nomicrowave">No</label> <br />
<hr />
Granite Counters <br />
<input type="radio" name="counter" id="counter" value="1" class="radio" /> <label for="counter">Yes</label>
<input type="radio" name="counter" id="nocounter" value="0" class="radio" /> <label for="nocounter">No</label> <br />
<hr />
Alarm <br />
<input type="radio" name="alarm" id="alarm" value="1" class="radio" /> <label for="alarm">Yes</label>
<input type="radio" name="alarm" id="noalarm" value="0" class="radio" /> <label for="noalarm">No</label> <br />
 
</div>
<div id="right">
Stainless Steel Appliances <br />
<input type="radio" name="appliance" id="appliance" value="1" class="radio" /> <label for="appliance">Yes</label>
<input type="radio" name="appliance" id="noappliance" value="0" class="radio" /> <label for="noappliance">No</label> <br />
<hr />
Air Conditioning <br />
<input type="radio" name="air" id="air" value="1" class="radio" /> <label for="air">Yes</label>
<input type="radio" name="air" id="noair" value="0" class="radio" /> <label for="noair">No</label> <br />
<hr />
Parking <br />
<input type="radio" name="parking" id="parking" value="1" class="radio" /> <label for="parking">Yes</label>
<input type="radio" name="parking" id="noparking" value="0" class="radio" /> <label for="noparking">No</label> <br />
<hr />
Heat <br />
<input type="radio" name="heat" id="heat" value="1" class="radio" /> <label for="heat">Yes</label>
<input type="radio" name="heat" id="noheat" value="0" class="radio" /> <label for="noheat">No</label> <br />
<hr />
Pets <br />
<input type="radio" name="pets" id="pets" value="1" class="radio" /> <label for="pets">Yes</label>
<input type="radio" name="pets" id="nopets" value="0" class="radio" /> <label for="nopets">No</label> <br />
<hr />
Yard <br />
<input type="radio" name="outside" id="outside" value="1" class="radio" /> <label for="outside">Yes</label>
<input type="radio" name="outside" id="nooutside" value="0" class="radio" /> <label for="nooutside">No</label> <br />
</div>
</fieldset>
<br /><br />
<fieldset style="width: 98%" class="ie_utilities">
<legend id="utilities">Paid Utilities</legend>
 
<input type="radio" name="water" id="water" value="1" class="radio" /> <label for="water">Paid Water</label>
<input type="radio" name="water" id="nowater" value="0" class="radio" /> <label for="nowater">No Paid Water</label> <br />
 
<input type="radio" name="power" id="power" value="1" class="radio" /> <label for="power">Paid Power</label>
<input type="radio" name="power" id="nopower" value="0" class="radio" /> <label for="nopower">No Paid Power</label> <br />
</fieldset>
<fieldset>
<legend id="extra">Extra Information</legend>
 
Specials: <br /><textarea rows="3" cols="100" name="specials"></textarea> <br />
Notes:  <br /><textarea rows="3" cols="100" name="notes"></textarea> <br />
</fieldset>
<fieldset>
<legend id="pictures">Pictures</legend>
<?php
############################## HTML FORM
    while($i++ < $upload_image_limit)
    {
        $form_img .=
        '<div class="upload">
        <div class="fakeupload">
        <input type="text" name="image'.$i.'" class="fakeupload" />
        </div>
        <input type="file" name="image'.$i.'" id="image'.$i.'" class="realupload" onchange="this.form.image'.$i.'.value = this.value;" />
        </div>';
    }
 
    $htmo .=
        '<p>'.$feedback.'</p>'
        .$form_img
        .$html; 
            
    echo $htmo;
?>
</fieldset>
<input name="Submit" type="submit" value="Save Listing" class='button' />
<input name="Cancel" type="submit" value="Clear Form" class='button' />
<a href="index.php" class="button">Cancel</a>
 </form>
 </div>
 <?php include("includes/footer.html"); ?>
 
 
faile486
Forum Newbie
Posts: 15
Joined: Wed Nov 18, 2009 8:12 pm

Re: Same CSS Displays Differently On Two Pages?

Post by faile486 »

This is the modify.php file. It displays differently than form.php

Code: Select all

 
<?php
include("includes/rating.php");
//Get the aptID
$aptID = $_GET[aptID];
 
/**************************************************************** IMAGE CODE (not mine, but modified by me) ****************************************************************/
 
$upload_image_limit = 21; // Limit to number of images uploaded at once.
 
//This function reads the extension of the file. It is used to determine if the file is an image by checking the extension.
 function getExtension($str) {
         $i = strrpos($str,".");
         if (!$i) { return ""; }
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 
 /******************** FORM SUBMIT CODE ********************/
 
//This variable is used as a flag. The value is initialized with 0 (meaning no error  found)  
//and it will be changed to 1 if an errro occures.  
//If the error occures the file will not be uploaded.
 $errors=0;
//checks if the form has been submitted
 if(isset($_POST['Submit'])) 
 {
     $con = mysql_connect();
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("kendramo_apartment", $con);
    
        $rating_total = getRating($_POST[bed], $_POST[rating], $_POST[bath], $_POST[distance], $_POST[price], $_POST[laundry], $_POST[sqFeet], $_POST[dw], $_POST[stove], $_POST[fridge], $_POST[water], $_POST[power], $aptID);  
    
    $sql="UPDATE apartments
    SET address = '$_POST[address]', c_name = '$_POST[c_name]', phone = '$_POST[phone]', email = '$_POST[email]', bed = '$_POST[bed]', bath = '$_POST[bath]',           
    distance = '$_POST[distance]', price = '$_POST[price]', sqFeet = '$_POST[sqFeet]',  type = '$_POST[type]', specials = '$_POST[specials]', notes = '$_POST[notes]', 
    rating = '$_POST[rating]', dw = '$_POST[dw]', laundry = '$_POST[laundry]', fridge = '$_POST[fridge]', stove = '$_POST[stove]', microwave = '$_POST[microwave]', 
    floor1 = '$_POST[floor1]', floor2 = '$_POST[floor2]', counter = '$_POST[counter]', alarm = '$_POST[alarm]', appliance = '$_POST[appliance]', air = '$_POST[air]', 
    parking = '$_POST[parking]', heat = '$_POST[heat]', pets = '$_POST[pets]', outside = '$_POST[outside]', url = '$_POST[url]', water = '$_POST[water]', power = '$_POST[power]', 
    rating_total = '$rating_total'
    WHERE aptID=$aptID";
 
    if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
        $last_id = $aptID;
        echo "Record " . $aptID . "updated!<br />\n";
 
$upload_dir = 'images/' . $aptID . '/';
if (!file_exists($upload_dir))
    {
        if (mkdir($upload_dir, 0777))
        {
            echo "1 directory created.";
        }
        else
        {
            echo "error.";
        }
    }
 
foreach($_FILES as $k => $v){ 
 
    $img_type = "";
 
    if( !$_FILES[$k]['error'] && preg_match("#^image/#i", $_FILES[$k]['type']) && $_FILES[$k]['size'] < 1000000){
 
            $img_type = ($_FILES[$k]['type'] == "image/jpeg") ? ".jpg" : $img_type ;
            $img_type = ($_FILES[$k]['type'] == "image/gif") ? ".gif" : $img_type ;
            $img_type = ($_FILES[$k]['type'] == "image/png") ? ".png" : $img_type ;
 
            $image_name=$last_id . '_' . $k . $img_type;
            $newname=$filepath.$image_name;
 
            $img_rname = $image_name;
            $img_path = $upload_dir.$img_rname;
 
            copy( $_FILES[$k]['tmp_name'], $img_path ); 
            $feedback .= "Image and thumbnail created $img_rname<br />\n";
$sql = "INSERT INTO images (aptID, location)
    VALUES
    (
     '$last_id',
     '$newname'
     )";
 
    if (!mysql_query($sql,$con))
        {
            die('Error: ' . mysql_error());
        }
        echo "1 image added. <br />\n";
}
        }
        mysql_close($con);
//If no errors registred, print the success message
 if(isset($_POST['Submit']) && !$errors) 
 {
    echo "<h1>Entry submited sucessfully!</h1>\n";
 }
 
/*********************************REDIRECT STATEMENT***********************************/
/*                                                                                    */
/*                                                                                    */
echo '<meta http-equiv="refresh" content="0;URL=template.php?aptID=' . $aptID . '">'; 
/*                                                                                    */
/*                                                                                    */
/*                                                                                    */
/*******************************POPULATE THE FORM*************************************/
 }
$sql2 = "SELECT * FROM apartments WHERE aptID=" . $aptID;
 
     $con = mysql_connect();
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("kendramo_apartment", $con);
 
?>
 
<!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=utf-8" />
<title>Editing Record - <?php echo $aptID ?></title>
<script language="javascript" type="text/javascript" src="scripts/browserdetect.js">
</script>
<style type="text/css">
/* STYLING FOR UPLOAD/SELECTS */
.upload {
    position:relative;
    width: 230px;
    float: left;
}
 
.realupload {
    position:absolute;
    top:0;
    left:0;
    opacity:0;
    -moz-opacity:0;
    filter:alpha(opacity:0);
    z-index:2; 
    width:74px;
    border: solid;
}
 
.fakeupload {
    background:url(images/nav_images/browse.jpg) no-repeat 100% 50%;
}
 
input.fakeupload {
    background: none;
    width:140px;
    height: 22px;
}
 
</style>
</head>
<body>
<?php include ("includes/header.html"); ?>
<div id='content'>
<div id='context_navbar'>
<a href='#info'>Basic Info</a> | 
<a href='#amenities'>Ameneties</a> | 
<a href='#utilities'>Utilities</a> | 
<a href='#extra'>Extra Info</a> | 
<a href='#pictures'>Pictures</a>
</div>
<br /><br />
 
<?php
$result = mysql_query($sql2, $con) or die('Could not connect: ' . mysql_error());
if(!result) {
    die('Result not returned: ' . mysql_error());
}
$num=mysql_num_rows($result);
 
mysql_close();
 
$i = 0;
while ($i < $num)
{
    $aptID = mysql_result($result, $i, "aptID");
    $address = mysql_result($result, $i, "address");
    $c_name = mysql_result($result, $i, "c_name");
    $phone = mysql_result($result, $i, "phone");
    $email = mysql_result($result, $i, "email");
    $rating = mysql_result($result, $i, "rating");
    $bed = mysql_result($result, $i, "bed");
    $bath = mysql_result($result, $i, "bath");
    $distance = mysql_result($result, $i, "distance");
    $price = mysql_result($result, $i, "price");
    $sqFeet = mysql_result($result, $i, "sqFeet");
    $laundry = mysql_result($result, $i, "laundry");
    $floor1 = mysql_result($result, $i, "floor1");
    $floor2 = mysql_result($result, $i, "floor2");
    $type = mysql_result($result, $i, "type");
    $specials = mysql_result($result, $i, "specials");
    $notes = mysql_result($result, $i, "notes");
    $dw = mysql_result($result, $i, "dw");
    $fridge = mysql_result($result, $i, "fridge");
    $stove = mysql_result($result, $i, "stove");
    $microwave = mysql_result($result, $i, "microwave");
    $alarm = mysql_result($result, $i, "alarm");
    $appliance = mysql_result($result, $i, "appliance");
    $air = mysql_result($result, $i, "air");
    $parking = mysql_result($result, $i, "parking");
    $heat = mysql_result($result, $i, "heat");
    $pets = mysql_result($result, $i, "pets");
    $outside = mysql_result($result, $i, "outside");
    $url = mysql_result($result, $i, "url");
    $water = mysql_result($result, $i, "water");
    $power = mysql_result($result, $i, "power");
    $rating_total = mysql_result($result, $i, "rating_total");
    $i++;
}
 
echo "<form name='newad' method='post' enctype='multipart/form-data'  action=''  class='form'>\n";
/**********************************BASIC INFORMATION*****************************/
echo "<fieldset class='basics'>\n";
echo "<legend id='info'>Basic Information</legend>\n";
echo "<label for='address'> Address:          </label><input type='text' name='address'  id='address'  value='" . $address  . "' /> <br />\n";
echo "<label for='c_name'>  Contact Name:     </label><input type='text' name='c_name'   id='c_name'   value='" . $c_name   . "' /> <br />\n";
echo "<label for='phone'>   Contact Phone:    </label><input type='text' name='phone'    id='phone'    value='" . $phone    . "' /> <br />\n";
echo "<label for='email'>   Contact Email:    </label><input type='text' name='email'    id='email'    value='" . $email    . "' /> <br />\n";
echo "<label for='distance'>Distance:         </label><input type='text' name='distance' id='distance' value='" . $distance . "' /> <br />\n";
echo "<label for='price'>Price: &nbsp; &nbsp; </label><input type='text' name='price'    id='price'    value='" . $price    . "' /> <br />\n";
echo "<label for='sqFeet'>  Square Feet:      </label><input type='text' name='sqFeet'   id='sqFeet'   value='" . $sqFeet   . "' /> <br />\n";
echo "<label for='type'>    Least Type:       </label><input type='text' name='type'     id='type'     value='" . $type     . "' /> <br />\n";
echo "<label for='url'>     Original Listing: </label><input type='text' name='url'      id='url'      value='" . $url      . "' /> <br />\n";
echo "<br /><br /><br /><br />\n";
echo "<div class='labels'>\n";
echo "<p>\n";
echo "<label for='rating' class='label'>Rating:</label> <br />\n";
echo "<label for='bed' class='label'>Bed:</label><br />\n";
echo "<label for='bath' class='label'>Bath:</label><br />\n";
echo "</p>\n";
echo "</div>\n";
echo "<div class='selects'>\n";
//RATING SWITCH STATEMENT
echo "<select id='rating' name='rating' style='width: 40px;'>\n";
switch ($rating) {
    case '1':
    {
        echo "<option value='1' selected='selected'>1</option>\n";
        echo "<option value='2'>2</option>\n";
        echo "<option value='3'>3</option>\n";
        echo "<option value='4'>4</option>\n";
        echo "<option value='5'>5</option>\n";
 
        break;
    }
    case '2':
    {
        echo "<option value='1'>1</option>\n";
        echo "<option value='2' selected='selected'>2</option>\n";
        echo "<option value='3'>3</option>\n";
        echo "<option value='4'>4</option>\n";
        echo "<option value='5'>5</option>\n";
    }
        break;
    case '3':
   {    
        echo "<option value='1'>1</option>\n";
        echo "<option value='2'>2</option>\n";
        echo "<option value='3' selected='selected'>3</option>\n";
        echo "<option value='4'>4</option>\n";
        echo "<option value='5'>5</option>\n";
   }
        break;
    case '4':
    {
        echo "<option value='1'>1</option>\n";
        echo "<option value='2'>2</option>\n";
        echo "<option value='3'>3</option>\n";
        echo "<option value='4' selected='selected'>4</option>\n";
        echo "<option value='5'>5</option>\n";
    }
        break;
    case '5':
    {
        echo "<option value='1'>1</option>\n";
        echo "<option value='2'>2</option>\n";
        echo "<option value='3'>3</option>\n";
        echo "<option value='4'>4</option>\n";
        echo "<option value='5' selected='selected'>5</option>\n";
    }
        break;
        
}
echo "  </select> <br />\n";
 
//BEDROOM SWITCH STATEMENT
echo "<select id='bed' name='bed' style='width: 40px;'>\n";
 
switch($bed) 
{
    case '1':
    {
        echo "          <option value='1' selected='selected'>1</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='3'>3</option>\n";
        echo "          <option value='4'>4</option>\n";
        echo "          <option value='5'>5</option>\n";
    }
        break;
    case '2':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='2' selected='selected'>2</option>\n";
        echo "          <option value='3'>3</option>\n";
        echo "          <option value='4'>4</option>\n";
        echo "          <option value='5'>5</option>\n";
    }
        break;
    case '3':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='3' selected='selected'>3</option>\n";
        echo "          <option value='4'>4</option>\n";
        echo "          <option value='5'>5</option>\n";
    }
        break;
    case '4':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='3'>3</option>\n";
        echo "          <option value='4' selected='selected'>4</option>\n";
        echo "          <option value='5'>5</option>\n";
    }
        break;
    case '5':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='3'>3</option>\n";
        echo "          <option value='4'>4</option>\n";
        echo "          <option value='5' selected='selected'>5</option>\n";
    }
        break;
}
echo "         </select> <br />\n";
 
//BATHROOM SWITCH STATEMENT
echo "<select id='bath' name='bath' style='width: 40px;'>\n";
 
switch($bath)
{
    case '1':
    {
        echo "          <option value='1' selected='selected'>1</option>\n";
        echo "          <option value='1.5'>1.5</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='2.5'>2.5</option>\n";
        echo "          <option value='3'>3</option>\n";
    }
        break;
    case '1.5':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='1.5' selected='selected'>1.5</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='2.5'>2.5</option>\n";
        echo "          <option value='3'>3</option>\n";
    }
        break;
    case '2':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='1.5'>1.5</option>\n";
        echo "          <option value='2' selected='selected'>2</option>\n";
        echo "          <option value='2.5'>2.5</option>\n";
        echo "          <option value='3'>3</option>\n";
    }
        break;
    case '2.5':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='1.5'>1.5</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='2.5' selected='selected'>2.5</option>\n";
        echo "          <option value='3'>3</option>\n";
    }
        break;
    case '3':
    {
        echo "          <option value='1'>1</option>\n";
        echo "          <option value='1.5'>1.5</option>\n";
        echo "          <option value='2'>2</option>\n";
        echo "          <option value='2.5'>2.5</option>\n";
        echo "          <option value='3' selected='selected'>3</option>\n";
    }
        break;
}
echo "         </select> <br />\n";
 
 
echo "</div>\n";
echo "</fieldset>\n";
 
/****************************AMENITIES**************************************/
echo "<fieldset class='ameny ieameny'>\n";
echo "<legend id='amenities'>Amenities</legend>\n";
//COL 1
//LAUNDRY SWITCH STATEMENT
echo "Laundry: <select id='laundry' name='laundry' style='width: 230px;'>\n";
switch ($laundry) {
    case '1':
    {
        echo "<option value='1' selected='selected'>Washer/Dryer In Unit</option>\n";
        echo "<option value='2'>Washer/Drryer Hookups In Unit</option>\n";
        echo "<option value='3'>Laundry On Premesis</option>\n";
        echo "<option value='4'>No Laundry</option>\n";
 
        break;
    }
    case '2':
    {
        echo "<option value='1'>Washer/Dryer In Unit</option>\n";
        echo "<option value='2' selected='selected'>Washer/Drryer Hookups In Unit</option>\n";
        echo "<option value='3'>Laundry On Premesis</option>\n";
        echo "<option value='4'>No Laundry</option>\n";
    }
        break;
    case '3':
   {    
        echo "<option value='1'>Washer/Dryer In Unit</option>\n";
        echo "<option value='2'>Washer/Drryer Hookups In Unit</option>\n";
        echo "<option value='3' selected='selected'>Laundry On Premesis</option>\n";
        echo "<option value='4'>No Laundry</option>\n";
   }
        break;
    case '4':
    {
        echo "<option value='1'>Washer/Dryer In Unit</option>\n";
        echo "<option value='2'>Washer/Drryer Hookups In Unit</option>\n";
        echo "<option value='3'>Laundry On Premesis</option>\n";
        echo "<option value='4' selected='selected'>No Laundry</option>\n";
    }
        break;
}
    
echo "          </select><br />\n"; 
 
//FLOORING 1 SWITCH STATEMENT
echo "Flooring: <select id='floor1' name='floor1' style='width: 100px;'>\n";
 
switch($floor1)
{
    case '1':
    {
        echo "          <option value='1' selected='selected'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '2':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2' selected='selected'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '3':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3' selected='selected'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '4':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4' selected='selected'>Linolium</option>\n";
    }
        break;
}
echo "          </select>\n";
 
//FLOORING 2 SWITCH STATEMENT
echo " <select id='floor2' name='floor2' style='width: 100px;'>\n";
switch($floor2)
{
    case '1':
    {
        echo "          <option value='1' selected='selected'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '2':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2' selected='selected'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '3':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3' selected='selected'>Carpet</option>\n";
        echo "          <option value='4'>Linolium</option>\n";
    }
        break;
    case '4':
    {
        echo "          <option value='1'>Hardwood</option>\n";
        echo "          <option value='2'>Tile</option>\n";
        echo "          <option value='3'>Carpet</option>\n";
        echo "          <option value='4' selected='selected'>Linolium</option>\n";
    }
        break;
}
echo "          </select> <br />\n";
 
 
//LEFT
echo "<div id='left'>\n";
echo "Dishwasher\n";
echo "<br />\n";
//DISHWASHER IF STATEMENT
if($dw == 1)
{
    echo "<input type='radio' class='radio' name='dw' id='dw'   value='1' checked='checked' /> <label for='dw'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='dw' id='nodw' value='0' />                   <label for='nodw'>No </label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='dw' id='dw'   value='1'/>                    <label for='dw'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='dw' id='nodw' value='0' checked='checked' /> <label for='nodw'>No </label> <br />\n";
}
 
echo "<hr />\n";
echo "Refridgerator\n";
echo "<br />\n";
//FRIDGE IF STATEMENT
if($fridge == 1)
{
    echo "<input type='radio' class='radio' name='fridge' id='fridge'   value='1' checked='checked' /> <label for='fridge'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='fridge' id='nofridge' value='0' />                   <label for='nofridge'>No </label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='fridge' id='fridge'   value='1' />                   <label for='fridge'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='fridge' id='nofridge' value='0' checked='checked' /> <label for='nofridge'>No </label> <br />\n";
}
 
echo "<hr />\n";
echo "Stove/Oven\n";
echo "<br />\n";
//STOVE IF STATEMENT
if($stove == 1)
{
    echo "<input type='radio' class='radio' name='stove'   id='stove'   value='1' checked='checked' /> <label for='stove'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='nostove' id='nostove' value='0' />                   <label for='nostove'>No </label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='stove'   id='stove'   value='1'/>                    <label for='stove'>  Yes</label>\n";
    echo "<input type='radio' class='radio' name='nostove' id='nostove' value='0' checked='checked' /> <label for='nostove'>No </label> <br />\n";
}
 
echo "<hr />\n";
echo "Microwave\n";
echo "<br />\n";
//MICROWAVE IF STATEMENT
if($microwave == 1)
{
    echo "<input type='radio' class='radio' name='microwave'   id='microwave'   value='1' checked='checked'/> <label for='microwave'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nomicrowave' id='nomicrowave' value='0' />                  <label for='nomicrowave'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='microwave'   id='microwave'   value='1'/>                    <label for='microwave'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nomicrowave' id='nomicrowave' value='0' checked='checked' /> <label for='nomicrowave'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Granite Counters\n";
echo "<br />\n";
//COUNTER IF STATEMENT
if($counter == 1)
{
    echo "<input type='radio' class='radio' name='counter'   id='counter'   value='1' checked='checked'/> <label for='counter'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nocounter' id='nocounter' value='0' />                  <label for='nocounter'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='counter'   id='counter'   value='1'/>                    <label for='counter'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nocounter' id='nocounter' value='0' checked='checked' /> <label for='counter'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Alarm\n";
echo "<br />\n";
//ALARM IF STATEMENT
if($alarm == 1)
{
    echo "<input type='radio' class='radio' name='alarm'   id='alarm'   value='1' checked='checked'/> <label for='alarm'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noalarm' id='noalarm' value='0' />                  <label for='noalarm'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='alarm'   id='alarm'   value='1'/>                    <label for='alarm'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noalarm' id='noalarm' value='0' checked='checked' /> <label for='noalarm'>No</label> <br />\n";
}
 
 
echo "</div>\n";
echo "<div id='right'>\n";
 
//COL 2
//APPLIANCE IF STATEMENT
echo "Stainless Steel Appliances\n";
echo "<br />\n"; 
if($appliance == 1)
{
    echo "<input type='radio' class='radio' name='appliance'   id='appliance'   value='1' checked='checked'/> <label for='appliance'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noappliance' id='noappliance' value='0' />                  <label for='noappliance'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='appliance'   id='appliance'   value='1'/>                    <label for='appliance'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noappliance' id='noappliance' value='0' checked='checked' /> <label for='noappliance'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Air Conditioning\n";
echo "<br />\n";
//AIR IF STATEMENT
if($air == 1)
{
    echo "<input type='radio' class='radio' name='air'   id='air'   value='1' checked='checked'/> <label for='air'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noair' id='noair' value='0' />                  <label for='noair'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='air'   id='air'   value='1'/>                    <label for='air'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noair' id='noair' value='0' checked='checked' /> <label for='noair'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Parking\n";
echo "<br />\n";
//PARKING IF STATEMENT
if($parking == 1)
{
    echo "<input type='radio' class='radio' name='parking'   id='parking'   value='1' checked='checked'/> <label for='parking'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noparking' id='noparking' value='0' />                  <label for='noparking'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='parking'   id='parking'   value='1'/>                    <label for='parking'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noparking' id='noparking' value='0' checked='checked' /> <label for='noparking'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Heat\n";
echo "<br />\n";
//HEAT IF STATEMENT
if($heat == 1)
{
    echo "<input type='radio' class='radio' name='heat'   id='heat'   value='1' checked='checked'/> <label for='heat'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noheat' id='noheat' value='0' />                  <label for='noheat'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='heat'   id='heat'   value='1'/>                    <label for='heat'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='noheat' id='noheat' value='0' checked='checked' /> <label for='noheat'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Pets\n";
echo "<br />\n";
//PETS IF STATEMENT
if($pets == 1)
{
    echo "<input type='radio' class='radio' name='pets'   id='pets'   value='1' checked='checked'/> <label for='pets'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nopets' id='nopets' value='0' />                  <label for='nopets'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='pets'   id='pets'   value='1'/>                    <label for='pets'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nopets' id='nopets' value='0' checked='checked' /> <label for='nopets'>No</label> <br />\n";
}
 
echo "<hr />\n";
echo "Yard\n";
echo "<br />\n";
//OUTSIDE IF STATEMENT
if($outside == 1)
{
    echo "<input type='radio' class='radio' name='outside'   id='outside'   value='1' checked='checked'/> <label for='outside'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nooutside' id='nooutside' value='0' />                  <label for='nooutside'>No</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='outside'   id='outside'   value='1'/>                    <label for='outside'>Yes</label>\n";
    echo "<input type='radio' class='radio' name='nooutside' id='nooutside' value='0' checked='checked' /> <label for='nooutside'>No</label> <br />\n";
}
echo "</div>\n";
echo "</fieldset>\n";
echo "<br /><br />\n";
/*****************************UTILIEIS*****************************/
echo "<fieldset style='width: 98%;' class='ie_utilities'>\n";
echo "<legend id='utilities'>Paid Utilities</legend>\n";
//WATER IF STATEMENT
if($water == 1)
{
    echo "<input type='radio' class='radio' name='water' id='water' value='1' checked='checked'/> <label for='water'>Paid Water</label>\n"; 
    echo "<input type='radio' class='radio' name='water' id='nowater' value='0' /> <label for='nowater'>No Paid Water</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='water' id='water' value='1'/> <label for='water'>Paid Water</label>\n";
    echo "<input type='radio' class='radio' name='water' id='nowater' value='0' checked='checked' /> <label for='nowater'>No Paid Water</label> <br />\n";
}
 
//POWER IF STATEMENT
if($power == 1)
{
    echo "<input type='radio' class='radio' name='power' id='power' value='1' checked='checked'/> <label for='power'>Paid Power</label>\n";
    echo "<input type='radio' class='radio' name='power' id='nopower' value='0' /> <label for='nopower'>No Paid Power</label> <br />\n";
}
else 
{
    echo "<input type='radio' class='radio' name='power' id='power' value='1'/> <label for='power'>Paid Power</label>\n";
    echo "<input type='radio' class='radio' name='power' id='nopower' value='0' checked='checked' /> <label for='nopower'>No Paid Power</label> <br />\n";
}
echo "</fieldset>\n";
/*******************************EXTRA INFO***********************/
echo "<fieldset>\n";
echo "<legend id='extra'>Extra Information</legend>\n";
echo "Specials: <textarea rows='3' cols='100' name='specials'>" . $specials . "</textarea> <br />\n";
echo "Notes:  <textarea rows='3' cols='100' name='notes'>" . $notes . "</textarea> <br />\n";
echo "</fieldset>\n";
 
/******************************PICTURES**************************/
echo "<fieldset>\n";
 
//Gets all info from the images table for the apartment ID
$sql3 = "SELECT * FROM images WHERE aptID=" . $aptID;
 
//Sets the connection statement
$con = mysql_connect();
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("kendramo_apartment", $con);
 
//Stores the results of sql3 query in a variable.
$result2 = mysql_query($sql3, $con) or die('Could not connect: ' . mysql_error());
if(!result) 
{
    die('Result not returned: ' . mysql_error());
}
 
//Determins the number of rows returned by the query, which gives us the number of images stored on the server for the particular apartment
if(mysql_num_rows($result2) > 0)
{
    $num=mysql_num_rows($result2);
}
else
{
//Initialized num, if there aren't any pictures stored on the server
    $num = 1;
}
 
//Counts the number of entries for a particular apartment
$query = "SELECT COUNT(location) FROM images WHERE aptID = $aptID";
 
$result = mysql_query($query) or die(mysql_error());
 
 
while($row = mysql_fetch_array($result))
{
    echo "<legend id='pictures'>";
    echo "There are ". $row['COUNT(location)'] ." images in directory ". $aptID;
    echo "</legend>\n";
    $picnum = $row['COUNT(location)'];
}
 
$i = 0;
while ($i < $num)
{
 
    if( $picnum > 1)
    {
        $i = $picnum;
    }
    else
    {
        $i = 1;
    }
 
    while($i++ < $upload_image_limit)
    {
        $form_img .= '
        <div class="upload">
        <div class="fakeupload">
        <input type="text" name="image' .$i .'" class="fakeupload" />
        </div>
        <input type="file" name="image'.$i.'" class="realupload" onchange="this.form.image' .$i. '.value = this.value;" />
        </div>';
    }
 
    $htmo .= '<p>'.$feedback.'</p>'
             .$form_img.' <br />';  
 
    echo $htmo;
}
echo "</fieldset>\n";
echo "<input name='Submit' type='submit' value='Save Listing' class='button' />\n";
echo "<a href='index.php' class='button'>Cancel</a>\n";
echo " </form>\n";
echo " </div>\n";
include("includes/footer.html"); 
?>
 
Post Reply