Add formatting into textarea that is copy and paste

Discussion in 'PHP' started by mipa jim, Feb 18, 2006.

  1. #1
    I have a little copy and paste text area on site: The code is below. I want to include formatting to it but just don't understand the way to place it in here and not blow it up.

    The things I'd like, atleast the way I see it are to add:

    <table cellpadding="6" cellspacing="0" bgcolor="CBE3F8" border="1" bordercolor="000000">

    and

    add text formatting like font-family: Verdana; font-size: 11px;


    Add this game to your website:<BR>
    <? if ($rewrite ==1){?>
    <textarea name="textarea" cols="30" rows="5" wrap="VIRTUAL"><img src = &quot;<?=$base_url;?>games/images/<?=$gameicon;?>&quot;><BR>
    <a href = &quot;<?=$base_url;?><?=$sedir;?>/<?=$segametitle;?>&quot; TITLE = &quot;Click to Play <?=$gametitle;?>&quot; TARGET = &quot;_blank&quot;>Click to Play!</a></textarea>
    <?}else{?>
    <textarea name="textarea" cols="30" rows="5" wrap="VIRTUAL"><img src = &quot;<?=$base_url;?>games/images/<?=$gameicon;?>&quot;><BR>
    <a href = &quot;<?=$base_url;?>index.php?action=playgame&gameid=<?=$gameid;?>&quot; TITLE = &quot;Click to Play <?=$gametitle;?>&quot; TARGET = &quot;_blank&quot;>Click to Play!</a></textarea>
    <?}?>
    <BR><BR>
    <?}?>
    
    Code (markup):
    can anyone help?
     
    mipa jim, Feb 18, 2006 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    You can use <textarea style="whatever style you want">

    Using the style tag in the text area should allow you to format anything in it to however you want.

    Something like this:
    
    <textarea stlye="background:#CBE3F8; border:1px solid #000; font-family:Verdana; font-size: 11px;">
    Your Content
    </textarea>
    
    Code (markup):
     
    jestep, Feb 18, 2006 IP
  3. mipa jim

    mipa jim Peon

    Messages:
    261
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks jestep, but it's not the textarea I want to format. But all the stuff referenced inside of it.

    
    <img src = "http://makeitplayagain.com/cd-repair-arcade/games/images/tetris.jpg"><BR>
    <a href = "http://makeitplayagain.com/cd-repair-arcade/games/Tetris-game" TITLE = "Click to Play Tetris game" TARGET = "_blank">Click to Play!</a>
    
    Code (markup):
    When the code runs it produces this to copy. Which works fine but if someone does copy and paste to a web page it has no style or format to it. I'm trying to have the copy all set up for them to just paste and it would be formatted nice.

    This is what what i'd like it to produce
    
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#00FF00" width="125" id="AutoNumber1" height="150" bgcolor="#EFEFEF">
    <tr>
    <td align="center" width="0"><img src="http://makeitplayagain.com/cd-repair-arcade/games/images/alias2_70x60.jpg" width="70" height="60"><br>
    <a href="http://makeitplayagain.com/cd-repair-arcade/games/ALIAS-2" TITLE="Click to Play ALIAS 2" TARGET="_blank">Click to Play Alias 2!</a><p><font size="2">@Makeitplayagain.com</font></td>
    </tr>
    </table>
    
    Code (markup):
    Does that make sense? OOpps game title are wrong but same code...
     
    mipa jim, Feb 18, 2006 IP