how to give people a code

Discussion in 'HTML & Website Design' started by promotingspace.net, Aug 11, 2007.

  1. #1
    hi
    when you want to give your users a peice of code to place on their site how do you do that?
    because codes are usually executed before displaying you know:confused:
    thanks
     
    promotingspace.net, Aug 11, 2007 IP
  2. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #2
    using codes inside the <textarea> tags will not execute them.
    Hope you get an idea and try working on it.
    Good luck .
     
    killerj, Aug 11, 2007 IP
  3. promotingspace.net

    promotingspace.net Peon

    Messages:
    361
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks
    i want to give them this code ( please notice the php variabes)
    
    <p align=center>
    <form method=POST action="<?php echo "http://domain.tld/search.php?searchid=$searchid&publisher=$publisher";?>" >
    <input type=text size="<?php echo $size; ?>" name="q">
    <input type=submit value="Search the Web" name=submit>
    </form>
    </p>
    HTML:
     
    promotingspace.net, Aug 11, 2007 IP
  4. bryandy

    bryandy Peon

    Messages:
    774
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    or just copy and paste it to them in an email lol
     
    bryandy, Aug 12, 2007 IP
  5. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #5
    you could try this :
    
    $somthing = '<p align=center><form method=POST action="http://domain.tld/search.php?searchid='.$searchid.'&publisher='.$publisher">
    <input type=text size="$size" name="q">
    <input type=submit value="Search the Web" name=submit></form></p>' ;
    
    
    PHP:
    and make a textarea for example :
     
    Here's your code : <TEXTAREA NAME="code" COLS=40 ROWS=6>
    <? echo $something  ?> 
    </TEXTAREA>
     
    PHP:
    Debug it yourself since i haven't tested it .
    good luck again.
     
    killerj, Aug 12, 2007 IP
  6. promotingspace.net

    promotingspace.net Peon

    Messages:
    361
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    solved
    php tags are executed in textareas but html ones are not. ( at least in ff)
     
    promotingspace.net, Aug 12, 2007 IP
  7. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #7
    yes .Php codes are executed in all browsers inside the textarea .
    even in my example , $something is a php code inside the textarea and gets executed to display the result.
    Anyway , I'm glad you got it working. :cool:
     
    killerj, Aug 12, 2007 IP
  8. Smaug

    Smaug Peon

    Messages:
    374
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Smaug, Aug 12, 2007 IP
  9. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #9
    you could use the <code> tag in html. Then just have to convert all the code to show up (so using &lt; instead of < and so on for all html special characters), this is what I do, so it will validate correctly.
     
    twistedspikes, Aug 12, 2007 IP