Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Thanked 0 Times in 0 Posts

    CSS not applied to table in DIV


    I have a php code in which the data is displayed in a table. The table is defined in <div> tag. When the data is displayed repeatedly in the table the position is not proper. Can somebody help me. My expectation is that the table should be positioned at the same place even it is repeatedly called.

    The code snippet is as follows:

    echo ("<html>");
    echo ("<head>");
    echo ("</head>");
    echo ("<body>");
    echo ("<form name='TablesTest'>");
    $istring = "1,2,3,4,5,|Desc1,Desc2,Desc3,Desc4,Desc5,|";
    echo ("<div style='POSITION: absolute; LEFT: 250px; WIDTH: 300px; TOP: 50px; HEIGHT: 50px;'id='NavButtons' name='NavButtons'>");
    echo ("<input type='Button' name='Next' value='Next' onClick='DisplayRecords();'>");
    echo ("</div>");
    echo ("</form>");
    echo ("</body>");
    echo ("</html>");

    function DisplayRecordSet($iname)
    list($iCodestring,$iDescstring) = explode("|",$iname);
    $iCode = explode(",",$iCodestring);
    $iDesc = explode(",",$iDescstring);
    echo ("<div style='POSITION: absolute; LEFT: 250px; TOP: 140px; WIDTH: 300px; HEIGHT: 300px;' id='Details' name='Details'>");
    echo ("<TABLE border=2>");
    echo ("<TR>");
    echo ("<TD colspan=15 align=center><SPAN style='color: #000'>ID</SPAN></TD>");
    echo ("<TD colspan=80 align=center><SPAN style='color: #000'>Description</SPAN></TD>");
    echo ("</TR>");
    for ( $x = 0; $x < 5; $x++)
    echo ("<TR><TD colspan=15><SPAN style='color: #000'>".$iCode[$x]."</SPAN></TD><TD colspan=80><SPAN style='color: #000'>".$iDesc[$x]."</SPAN></TD></TR>");
    echo ("</TABLE>");
    echo ("</div>");

    <script type="text/javascript">
    function DisplayRecords()
    document.getElementById("NavButtons").innerHTML= "<?php DisplayRecordSet("10,20,30,40,50,|Desc10,Desc20,Desc30,Desc40,Desc50,|"); ?>";

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 Posts
    This is the wrong forum; this one is designed for posting usable snippets for PHP.

    I'm not convinced this is a problem with PHP. It looks to me like this is an issue with your HTML/CSS and potentially your JS. Best I can tell from looking at this, the PHP itself should process just fine without any errors.
    For the meantime, I'll move this to HTML/CSS, unless its determined to be an issue with the JS.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


    Tags for this Thread

    Posting Permissions

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