style in php code

Discussion in 'PHP' started by oo7ml, Jul 5, 2007.

  1. #1
    How do i apply a class (stlyesheet class) to the code below. I tried wrapping <span> tags around the php code, but it didn't work.

    Note: the code below is in html code

    <?php
    }
    else
    {
    echo "No county selected... Please select a county\n";
    
    ?>
    PHP:
     
    oo7ml, Jul 5, 2007 IP
  2. Cloudberries

    Cloudberries Peon

    Messages:
    74
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you wrapped <span> elements around those two php tags, it wouldn't work because the first span would be lying within the first section of conditional code

    (You can create conditional statements for HTML code too, i.e.
    
    <?php if($a==1)
    {
    ?>
    Hello
    <?php } else { ?>
    Goodbye
    <?php } ?>
    
    Code (markup):
    would work just fine.

    Try adding the <span> tags inside the echo statement, like
    
    echo "<span class='cssstyle'>No county selected... Please select a county</span>\n";
    
    Code (markup):
     
    Cloudberries, Jul 5, 2007 IP
  3. drbones

    drbones Peon

    Messages:
    172
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3


    Agrees with Clouberries... the php tags tell the server what to process, the echo is what is goig to be what is written to the output file.
     
    drbones, Jul 5, 2007 IP