WChampion WChampion - 6 months ago 8
CSS Question

php search results page yielding non "eye" appealing data

So I finnaly got my php database search to function properly but im unaware of how to format it to make it look nicer.

Currently my echo code is

echo "<p><h3>".$results['lfname']."</h3>".$results['id'].$results['phonenum'].$results['state'].$results['zip']."</p>";


and the data i receive is like

John Doe
12507(704) 372-2622NC28031


I would like the data to be like

John Doe 12507
(704) 372-2622 NC 28031


or something of that sort. Do you guys know how i could format this properly or any links to any pages where i could learn how to format this results. Wasn't sure of what to google since im not sure of the rules and limits of php pages.
Thanks again

Answer

Theoretically, it is ill-advised to wrap a heading Tag within a Paragraph tag. Secondly, the ID is outside the Tag. And since is a block-level Element, You shouldn't expect its contents to be on the same Level as the ID. Here's what may help:

            <!-- TO STYLE THE CSS CLASSES, AT THE TOP OF YOUR FILE WITHIN THE HEAD SECTION-->
            <!-- DO LIKE SO -->
            <style type="text/css">
                .full-name{
                    font-weight: 900;    /*CAN BE NORMAL, BOLD OR BOLDER OR USE NUMBERS FROM 100 TO 900*/
                    color: #613ac5;       /* USE YOUR PREFERRED COLOR */
                    font-size: 12px;      /* AGAIN CHANGE TO YOUR DESIRED FONT-SIZE */
                }
                .result-id{
                    font-family: Helvetica, Arial, sans-serif;
                    font-weight: normal;  /*CAN BE NORMAL, BOLD OR BOLDER OR USE NUMBERS FROM 100 TO 900*/
                    color: #8c0210;       /* USE YOUR PREFERRED COLOR */
                    font-size: 12px;      /* AGAIN CHANGE TO YOUR DESIRED FONT-SIZE */
                }

                .right-spaced{
                    font-family: Helvetica, Arial, sans-serif;
                    display:inline-block;
                    padding-right: 15px;
                    font-weight: normal;  
                    color: #8c0210;    
                    font-size: 12px;     
                }
            </style>


        <?php

            $strOutput    =  "<h3 class='full-name'> " . $results['lfname'] ."<span class='result-id'> {$results['id']}</span></h3>";
            $strOutput   .= "<p><span class='phone right-spaced'>{$results['phonenum']}</span>";
            $strOutput   .= "<span class='state right-spaced'>{$results['state']}</span>";
            $strOutput   .= "<span class='zip right-spaced'>{$results['zip']}</span>";
            $strOutput   .= "</p>";
Comments