Hey guys,

got this weird error. I have 3 divs. Each with different forms in. Div 1 and Div 2 work fine, they sit next to each other no errors. But div 3 doesn't exist apparently. I'm unsure of where it has moved or why it's deleted.

Picture: http://puu.sh/3yDRM.png

As you can see there is only 2 colums. Not a third.


<div id="window" style="width:300px; border:solid 1px; float:left;">
    <div id="title_bar" style="background: #FFAE00; height: 25px; width: 100%;"> Add User
    <div id="box" style="background: #DFDFDF;">
"<form method=\"post\" action=\"adduser_ac.php\">" .
<span class=\"small\"></span>
</label> <input type=\"text\" name=\"Employer\" /><br /><br>" .
"<label>Learning Provider
</label> <input type=\"text\" name=\"LearningProvider\" /><br>" .
"<label>Contracted Provider
</label> <input type=\"text\" name=\"ContractedProvider\" /><br>" .
"<label>Learning Delivery Site:
</label>  <input type=\"text\" name=\"LearningDeliverySite\" /><br>" .
"<label style=\"display: inline-block\">Vacancy Description:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"VacancyDescription\" style=\"display: inline-block; margin-left:10px;\"/> </textarea><br>" .
"<label>Vacancy Title:
</label> <input type=\"text\" name=\"VacancyTitle\" /><br>" .
"<label>Employer Description:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"EmployerDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<label>Vacancy Location:
</label> <input type=\"text\" name=\"VacancyLocation\" /><br>" .
"<label> Working Week Hours:
</label> <input type=\"number\" name=\"WorkingWeek\" /><br>" .
"<label>Weekly Wage:
</label> <input type=\"text\" name=\"WeeklyWage\" /><br>" .
</label> <input type=\"text\" name=\"NoVacancies\" /><br>" .
"<label>Reference Number:
</label> <input type=\"text\" name=\"VacancyRefNumber\" /><br>" .
"<label>Closing Application Date:
</label> <input type=\"date\" name=\"ClosingDateForApplications\" /><br>" .
"<label>Interview Start Date:
</label> <input type=\"date\" name=\"InterviewBeginFrom\" /><br>" .
"<label>Possible Start Date:
</label> <input type=\"date\" name=\"PossibleStartDate\" /><br>" .
"<label>Training to be provided:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"TrainingToBeProvided\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<label>Learning Provider Desc:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"LearningProviderDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<label>Contact Details:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"ContactDetails\" style=\"display: inline-block; margin-left:10px;\"/> </textarea><br>" .
"<label>Vacancy Type:
</label> <input type=\"text\" name=\"VacancyType\" /><br>" .
"<label>Apprenticeship Framework:
</label> <input type=\"text\" name=\"ApprenticeshipFramework\" /><br>" .
"<label>Skills Required:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"SkillsRequired\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<label>Personal Qualities:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"PersonalQualities\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<label>Other Information:
</label> <textarea rows=\"5\" Cols=\"22\" name=\"ImportantOtherInformation\" style=\"display: inline-block; margin-left:10px;\"/></textarea><br>" .
"<input type=\"text\" name=\"Website\" /><br>" .
"<input type=\"submit\" value=\"Add Vacancy\" name=\"\" />";

<!-- SECOND -->

<div id="window" style="margin-left: 10px; width:300px; border:solid 1px; float:left;">
    <div id="title_bar" style="background: #FFAE00; height: 25px; width: 100%;"> Delete User
    <div id="box" style="background: #DFDFDF;">
    <span class="warning">Warning: Once deleted it is gone forever</span>
    <form method="post" action="deleteuser_ac.php">
    <select name='ID'>
            $con= mysqli_connect("localhost", "","", "") or die();
            $sql="SELECT ID,Employer FROM details";
            $result =mysqli_query($con,$sql);
            while ($data=mysqli_fetch_assoc($result)){
      <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>
         <?php } ?>
            <input type="submit" value="Delete User" name='submit'></p> 

<!-- THIRD -->

<div id="window" style="margin-left: 10px; width:300px; border:solid 1px; float:right;">
    <div id="title_bar" style="background: #FFAE00; height: 25px; width: 100%;"> Update User
    <div id="box" style="background: #DFDFDF;">
<h2>Update Select</h2>
    <form method="post" action="Update.php">
    <select name='ID'>
            $sql_update="SELECT ID,Employer FROM details";
            $result =mysqli_query($con,$sql_update);
                //$employer_id = $_POST['ID'];
            while ($data=mysqli_fetch_assoc($result)){
      <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>
         <?php } ?>
            <input type="submit" value="Update User" name='submit'></p> 

While this won't answer your question, I thought I should bring it to your awareness...

echo "\t<option value=\" $data['ID'] \"> $data['Employer'] </option>\r\n";

Is totally valid, and you don't have to end php to produce HTML.
I say this because I feel that it would improve the readability of your code.

At any rate, why don't you check out the page in FireBug or something?

P.S. You </div> four times during <!-- SECOND --> while it is open only twice. I have no idea what it is nested in, but it could certainly matter.

Not really sure how to use Firebug in this scenario. Using Firebug does confirm it doesn't exist.

I have 2 window div tags not 3

You should review the validity of your HTML. While it might not solve the issue in this case, it often helps ruling out other items. Try using http://validator.w3.org. Some errors I see of the bat:

A) Your TEXTAREA tags are self-terminating, yet are followed up with a closing tag. Textareas should not self-terminate. Line 18:

<textarea rows=\"5\" Cols=\"22\" name=\"VacancyDescription\" style=\"display: inline-block; margin-left:10px;\"/> </textarea>

PHP would print this out as

<textarea rows="5" Cols="22" name="VacancyDescription" style="display: inline-block; margin-left:10px;"/> </textarea>
                                                                                                       ^ Note this slash. That's a problem.

B) You should not have more than one occurrence of an id on a page. If the value needs to be used more than once, you should be using a class. So instead of id="window", id="title_bar", or id="box", use class="window", class="title_bar", class="box". Do the same for any other such examples.

C) As mentioned above, in <!-- SECOND --> you open DIVs on lines 63 and 66, but on lines 83 and 84 there are a total of four closing </div> tags. This probably ends up closing 2 container divs, which would throw off your whole layout.

Just a note. For debugging something like this it's also useful to see the container DIVs and their CSS, considering your usage of widths, borders, margins and floats for layout.

commented: Solid post +4

I've found the issue is the php within the last 2 windows.

Glad it's fixed, though I can't spot the error. Anything simple to explain?

Please marked solved if you're all done.

I pretty much wasn't connecting the database properly leaving some errors to throw the rest of the page. Solved.