Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2006
    Location
    Charlottesville, VA
    Posts
    94
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Hidden fields create space in IE table display

    Well, I have forms which submit data to a review screen before final submission.

    https://www.coreknowledge.org/secure...onfregform.php
    also
    http://www.coreknowledge.org/secure/...rekprofile.php

    Problem: The review display, in IE only, has a lot of blank space at the top. It annoys me, because it is silly.

    I finally found what's causing it, but I don't know what to do about it.

    I copied the browser source from the review page display, and created a new HTML page in Dreamweaver from it. That page showed the exact same behavior in IE, but not in Firefox. When I deleted all the hidden data fields introduced from the $_SESSION, the space disappeared. The more hidden input fields, the more space.

    What do you think can be done about that?

    *ponder*
    I could load the session data into a display array, and display that instead of directly echoing the session data... ? I actually do that for the participant list on the conference registration form; that does not create a big space, and does not echo all those hidden fields.

    Hmmm. Perhaps I've answered my own question.

    ---Opally

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    So... did you answer your own question?

    Those links you provided don't work btw.

    I don't believe a hidden field would create anything visible in IE (or any browser for that matter), otherwise it would be a problem for everyone... I'd have to see the raw code to be of any help.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Agreed, this probably isn't a php issue, but an HTML issue.
    Perhaps each hidden field is being placed in a table cell? Maybe its own div?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #4
    New Coder
    Join Date
    Feb 2006
    Location
    Charlottesville, VA
    Posts
    94
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi,

    Actually, I still have a problem, cuz I'm not sure how to write the PHP code.

    Sorry the links didn't work, I didn't realize I had to actually, er, add the linkage to the URL:

    https://www.coreknowledge.org/secure/html_forms/confregform.php


    https://www.coreknowledge.org/secure...rekprofile.php

    I think it is a PHP problem, combined with IE7 weirdness.

    What I need to do, I think, is load the $_SESSION array into a new associative array of field titles and field values, and display that instead of the actual $_SESSION array. There are 2 sections of display on the conference review page. The first section directly takes the $_SESSION array and displays it. It does somehow generate hidden fields that do force space at the top of the page in IE7. The second part of the display involves taking some of the values from the $_SESSION and loading them into a new array, and displaying that. There is no extra space or hidden fields generated there.

    But I do need
    PHP Code:
    <input type="hidden" name="<?php echo $key?>" value="<?php echo htmlspecialchars($valueENT_QUOTES); ?>" />
    to convey my data to the Perl/CGI form processor.

    If someone would give me an itty bitty hand in how to load the trimmed, etc., session array into a new array, and display that, instead of all those hidden fields, I'd be, oh, ecstatic!

    Here's what I've got, with extraneous stuff snipped, to keep it reasonably short:

    PHP Code:
    <?php
        session_start
    ();
        include(
    './includes/regisform_select_options.php');
        
        
    define('MAGIC_QUOTES'get_magic_quotes_gpc());
        
        if( !empty(
    $_POST) ) {
            
    /**
             *    So let's delete the $_SESSION and add the latest information again.
            **/
            
    unset($_SESSION['prekprofile']);
            foreach(
    $_POST as $key => $value) {
                
    $_SESSION['prekprofile'][$key] = ( (MAGIC_QUOTES) ? trim(strip_tags(stripslashes($value))) : trim(strip_tags($value)) );
            }
        } else {
            
    /* They directly accessed this page so we send them back */
            
    header('Location: prekprofile.php');
            exit;
        }    
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Preschool Profile Review</title>

    </HEAD>

    <body>

    <h2 align="center" class="prekTitle">Core Knowledge Preschool Profile Update Form</h2>
    <div id="regform">
     <FORM METHOD="POST" ACTION="../cgi-bin/form_processor_prekprofile.cgi" ENCTYPE="x-www-form-encoded" name="prekprofile" id="prekprofile">
       
        <INPUT TYPE="hidden" NAME="setup_file" VALUE="prekprofile.setup">    
        <table width="680" border="0" align="center" cellpadding="4" cellspacing="4" style="background-color: #FEF9FF; border: 2px solid #CC66CC; margin-top:1em;">
          <tbody>
          <tr>
            <td><fieldset id="review">
              <legend class="purpleTitle">6. Review Your Information</legend>          
              <table border="0" cellpadding="4" cellspacing="0" width="100%">
                         <?php                     
                        $displayed 
    = array();                    
                        foreach(
    $_SESSION['prekprofile'] as $key => $value) {
                            
    /**
                             * So we make all the fields from the form hidden here 
                            **/
                            
    ?>
                                <input type="hidden" name="<?php echo $key?>" value="<?php echo htmlspecialchars($valueENT_QUOTES); ?>" />
                            <?php
                            
    /**
                             *    Let's skip the empty rows
                            **/
                            
    if( trim($value) == '' ) {
                                continue;
                            }
                            
    /**
                             *    Check and see if this row is a duplicate
                            **/
                            
    if( !in_array($key$displayed) ) {
                                
    $displayed[] = $key/* We didn't show this field so add it to our array */
                            
    } else {
                                
    /* This one is duplicate skipping... */
                                
    continue;
                            }
                            
    /**
                             * And show them what they entered                         
                            **/
                            
    switch($key) {
                                
                                case 
    'name' :    
                                    
    $field_title 'Contact name';
                                    
    $field_value ucwords($value);
                                    break;
                                
                                case 
    'street' :
                                case 
    'city' :
                                case 
    'zip' :
                                    
    $field_title ucwords(strtolower($key));
                                    
    $field_value ucwords($value);
                                    break;

                                case 
    'subtotal' :                                            
                                    
    $field_title 'Total';
                                    
    $field_value $value;
                                    break;
                                
                                case 
    'institution' :
                                    
    $field_title 'Organization / School';
                                    
    $field_value ucwords($value);
                                    break;                            
                                
                                case 
    'phoneday' :
                                    
    $field_title 'Phone: (day)';
                                    
    $field_value $value;
                                    break;
                                
                                case 
    'state' :
                                    
    $field_title ucwords(strtolower($key));
                                    
    $field_value $state$value ];
                                    break;
                                    
                                case 
    'email' :
                                    
    $field_title 'E-mail';
                                    
    $field_value $value;
                                    break;

    /* snipped a lot of cases here, for defining field title 
                                
                                /** 
                                 * If we covered all the fields in our case statements then we also make a default rule
                                **/
                                
    default :
                                    
    $field_value false;
                                    break;
                                
                            }

                            
                            
    /**
                             * Now we check if the field value is not false 
                            **/
                            
    if( $field_value != false ) { 
                            
    ?>
    <tr>                  
                                 <td width="50%" align="right" class="blackmediumbigbold"><?php echo $field_title?>:</td>
                                 <td width="50%" class="blacksmall"><?php echo htmlspecialchars($field_valueENT_QUOTES);?></td>
                </tr>
                            <?php
                            
    // If
                        
    // Foreach
                        
    ?>              
               </table>  
                    </fieldset>

  • #5
    New Coder
    Join Date
    Feb 2006
    Location
    Charlottesville, VA
    Posts
    94
    Thanks
    5
    Thanked 0 Times in 0 Posts
    By the way, this is what the source looks like for the generated review page. There is an <input type="hidden"...> before each row which displays the data, that's what's creating extra space above the entire table in IE7.

    Code:
    <table border="0" cellpadding="4" cellspacing="0" width="100%"><tbody>
    		<input type="hidden" name="setup_file" value="confregformPHP.setup" />
    													<input type="hidden" name="name" value="qwer" />
    			<tr>				  
    				<td width="33%" align="right" class="blackmediumbigbold">Contact name:</td>
    				<td width="79%" class="blacksmall">Qwer</td>
    			</tr>
    													<input type="hidden" name="institution" value="qwer" />
    			<tr>				  
    				<td width="33%" align="right" class="blackmediumbigbold">Organization / School:</td>
    				<td width="79%" class="blacksmall">Qwer</td>
    			</tr>
    													<input type="hidden" name="street" value="qwer" />
    			<tr>				  
    				<td width="33%" align="right" class="blackmediumbigbold">Street:</td>
    				<td width="79%" class="blacksmall">Qwer</td>
    			</tr>

  • #6
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Well here's my guess.... the <input tags are inside a <table> tag </table>, but do not fall within a <td> tag </td> or even a <tr> tag </tr>, so IE7 destroys the page formatting. Typical IE behavior. Bad IE, Bad.

    So, what you should do, is put that hidden input field inside a <td> tag. Even before that, though, you should validate the page's HTML, as that might just clear up the problem altogether. (You may want to consider a different doctype as "strict" is not fond of table-driven layout)

  • #7
    New Coder
    Join Date
    Feb 2006
    Location
    Charlottesville, VA
    Posts
    94
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks for reply, Fumigator!

    Doctype was a cool idea, but it didn't make a difference.

    But AHAH!!!! Moving that
    PHP Code:
    <input type="hidden" name="<?php echo $key?>" value="<?php echo htmlspecialchars($valueENT_QUOTES); ?>" />
    inside the last <TD> for the generated table did the magic trick!!!!

    Thanks a TON!!!!!!

    ---Opally


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •