Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP generating gaps in HTML?
Old 09-10-2007, 11:08 AM PHP generating gaps in HTML?
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Arghhhh this had been stressing me out for ages!

I have a for loop in my script which generates div's with thumbnail images inside them.

here is my code:
Code:
<form id="form2" name="form2" method="post" action="">
      <fieldset>
      <legend>Image select</legend>
      
      <?php
      include "../conn.php";
      
      //get photo names
        $sql=mysql_query("SELECT * FROM photos WHERE model='name'");
        if(!$sql)
            {
                echo 'MySQL Error: '.mysql_error();
            }
        
        while($row=mysql_fetch_array($sql))
            {
                echo '<div class="modelthumb"><p>
                <img src="../Images/Photos/'.$row['file'].'" /></p>
                <form id="form'.$row['id'].'" name="form'.$row['id'].'" 
                method="post" action="index.php" class="zero">
                <input name="hiddenField" type="hidden" 
                value="'.$row['id'].'" />
                <input type="submit" name="Submit'.$row['id'].'" value="Delete" />
                </form>
                </div>';
            }
      ?>
        </fieldset>
    </form>
but the code produced turns out like this:
Code:
<form id="form2" name="form2" method="post" action="">
      <fieldset>
      <legend>Image select</legend>
      
      <div class="modelthumb"><p>
                <img src="../Images/Photos/5.jpg" /></p>
                <form id="form3" name="form3" 
                method="post" action="index.php" class="zero">
                <input name="hiddenField" type="hidden" 
                value="3" />
                <input type="submit" name="Submit3" value="Delete" />
                </form>
                </div><div class="modelthumb"><p>
                <img src="../Images/Photos/7.jpg" /></p>
                <form id="form5" name="form5" 
                method="post" action="index.php" class="zero">
                <input name="hiddenField" type="hidden" 
                value="5" />
                <input type="submit" name="Submit5" value="Delete" />
                </form>
                </div><div class="modelthumb"><p>
                <img src="../Images/Photos/8.jpg" /></p>
                <form id="form6" name="form6" 
                method="post" action="index.php" class="zero">
                <input name="hiddenField" type="hidden" 
                value="6" />
                <input type="submit" name="Submit6" value="Delete" />
                </form>
                </div><div class="modelthumb"><p>
                <img src="../Images/Photos/9.jpg" /></p>
                <form id="form7" name="form7" 
                method="post" action="index.php" class="zero">
                <input name="hiddenField" type="hidden" 
                value="7" />
                <input type="submit" name="Submit7" value="Delete" />
                </form>
                </div>        </fieldset>
    </form>
Notice how all of the code is more indented than the first div tag. I think it's this that is what is causing an unnecesary gap in the first div in IE6. This is out of the 4 div's that are output onto the screen. It could be down to something else but I've tried a lot of different things and nothing seems to work!
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 09-10-2007, 11:36 AM Re: PHP generating gaps in HTML?
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
Hi there,

Run it through w3schools validator to check the markup.

Anyway, having a real quick look - you have html form inside form, that will cause you a whole load of trouble... you shouldnt need form within form, tidy that up...

any the reason you have gaps is because each form tag puts a new line space... you can fix it by putting

Quote:
style="margin-bottom:0;"
inside your form tags

Cheers
Sir P
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 09-10-2007, 11:54 AM Re: PHP generating gaps in HTML?
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
thanks! removing the main form tag fixed it
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 09-10-2007, 11:59 AM Re: PHP generating gaps in HTML?
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
no worries, good work.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Reply     « Reply to PHP generating gaps in HTML?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30101 seconds with 12 queries