#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Cool How to use css in my code?


    hi!
    i want to apply css on this code :
    PHP Code:
    <?php

    $connect 
    mysql_connect("localhost""root""1234567");
    if (!
    $connect) {
        die(
    "Could not connect: " mysql_error());
    }
    print 
    "Connected successfully";

    if (!isset(
    $_POST['submit_form'])) {
        echo 
    '<form name="search_form1" id="form" method="POST" action="search.php">
            <input type="text" style="width: 300px; display: block; margin: 0 auto; height: 36px; text-align: center; font-size: 16px;" name="search_name" placeholder="חפש מספר פלאפון.." />
            <input type="submit" value="Submit" name="submit_form" />
            </form>'
    ;
    } else {
        
    $search_name $_POST['search_name'];
        
    $query mysql_query("SELECT * FROM `search_engine` WHERE (`phonenumber` like '%".$search_name."%')");
        
    $count mysql_num_rows($query);
        while(
    $row mysql_fetch_array($query)) {
            
    $fname $row['phonenumber'];
            
    $lname $row['firstname'];
            print 
    '<a href="'.$row['firstname'].'">'.$row['phonenumber'].'</a><br />';
        }
    }
    mysql_close($connect);

    ?>
    [[ when posting code, please paste it into the text box, select it, and then hit the PHP code button. not the other way around --requinix ]]

    what i need to do? where to put the css? i want to margin the printing text and design it with css.. thanks you all!
    Last edited by requinix; July 26th, 2013 at 03:10 PM. Reason: reformatted
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,846
    Rep Power
    6351
    PHP generates HTML documents. Wherever in the PHP your HTML headers are located, put your CSS reference there. The CSS file should probably be external, given then condition of your code. Just include it in the header when you need it.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo