SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I send valid html to a browser?

    Hi,
    I have the following variable, $text and it contains the following
    Code:
    test
    When I send this to the browser, I get this exact text, but I want the word test outputted in bold, do I need to format it in another way?


    Thanks in advance.

  2. #2
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doh, it writes it a bold here also

    Basically, I am sending the tag the browser and its coming out as text.

  3. #3
    messing with my mind fristi's Avatar
    Join Date
    Feb 2009
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by livewire1974 View Post
    Hi,
    I have the following variable, $text and it contains the following
    Code:
    test
    When I send this to the browser, I get this exact text, but I want the word test outputted in bold, do I need to format it in another way?


    Thanks in advance.
    you need to use HTML tags:

    PHP Code:
    <?php
    $test 
    '<b>test</b>';
    echo 
    $test;
    ?>
    you used bbc tags as I can see. They are only valid on forms which are coded to understand them.
    To PHP or to Perl, that is the question!
    (Bucket - simpletest) User

  4. #4
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some code demonstrating how you're outputting it would be helpful at the least.

  5. #5
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is what the variable contains

    Code:
    <?php
    $test = 'test';
    echo $test;
    
    ?>
    This is valid?

  6. #6
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it the same for the italics tag. i .

  7. #7
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    tags have < and > around them, not [ and ]

  8. #8
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    tags have < and > around them, not [ and ]
    Stupid mistake by me, its formatting from a rich text editor I am using. Going to get a hammer and hit my head now for my stupidity.


Bookmarks

Posting Permissions

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