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 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Output not displaying correctly

    Howdy folks

    scott.loddonexplorers.co.uk/contacts.php

    Two problems with this. The first is that i cannot see the images that should be two the left of everyones name, i can see it when i click to the left of the persons name though. And secondly, the page displays all the data, i only want it so that when you click to the left of the name it displays all the data. Before clicking the button it should only display Each persons name and email...

    Any ideas on how to fix this?

    Fet

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code is

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Leaders</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link href="css/phpdisplay.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
    function showDetails(memberID,button){
        var element = document.getElementById(memberID);
        if(element.style.display != 'block'){
            element.style.display = 'block';
            button.style.backgroundImage = 'url("images/minus.gif")';
        }else{
            element.style.display = 'none';
            button.style.backgroundImage = 'url("images/plus.gif")';
        }
    }
    </script>


    </head>
    <body>
    <?php

    $connx 
    = @mysql_connect("xx""cxx""xx") or
             die(
    "ERROR: Unable to establish database connection");

    $dbconnx = @mysql_select_db('xx) or
             die("ERROR: Unable to establish database connection");

    ?>
    <p class="title">Leader Team</p>
    <blockquote>

    <?php

    $result = @mysql_query('
    SELECT FROM `ContactsGROUP BY `ID`'); 
                                                                            
                                                                                   
    if (!$result) {
    exit('
    <p>Error performing query' . mysql_error() . '</p>');
    }
    $num = mysql_num_rows($result);
    echo "<div id=\"alldetails\">";
        for ($i=0; $i<$num; $i++)
        {
            $row = mysql_fetch_row($result);
            echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('
    person$i,this);return true;"> $row[2] $row[3] <a href=\"mailto:$row[9]\">$row[9]</a></p>\n";
            echo 
    "<p id=\"person$i\" class=\"details\">
                    Position:  $row[1]<br>\n
                    Name: $row[2] $row[3]<br>\n
                    Address: $row[4]<br>\n
                    Town: $row[5]<br>\n
                    Postcode: $row[6]<br>\n
                    Home Phone: $row[7]<br>\n
                    Mobile: $row[8]<br>\n
                    Email: $row[9]</p>"
    ;
        }
    echo 
    "</div>";
    ?>
    </blockquote>
    </div>

    </body>
    </html>

  • #3
    New Coder
    Join Date
    Oct 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by scottyrob
    Code is

    echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('person$i',this);return true;\"> $row[2] $row[3] <a href=\"mailto:$row[9]\">$row[9]</a></p>\n";
    echo "<p id=\"person$i\" class=\"details\">
    Position: $row[1]<br>\n
    Name: $row[2] $row[3]<br>\n
    Address: $row[4]<br>\n
    Town: $row[5]<br>\n
    Postcode: $row[6]<br>\n
    Home Phone: $row[7]<br>\n
    Mobile: $row[8]<br>\n
    Email: $row[9]</p>";
    i *think* that if you make the images just images that part will be fixed, as for the expanded content you'll have to set the display style to none in the DIVs when making output so that the onclick will expand them...

    at least i think, i just used someone elses code when i wanted to do it...


  •  

    Posting Permissions

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