looking for help building simple form script

Discussion in 'PHP' started by mikemason, Jun 23, 2009.

  1. #1
    I want to help my visitors add "Tweet This" buttons to their posts on other sites by giving them the code & hosting the image.

    So we have a form with a textarea box and a "get it" button, below that is a textarea to copy from

    the script would create the link from this:
    <a href="http://twitter.com/home?status=textarea_box"><IMG SRC="http://n4a.us/images/tweet_this.gif" BORDER="0" ALT="Tweet This"></a>
    Code (markup):
    AND this:

    [url=http://twitter.com/home?status=textarea_box][ img]http://n4a.us/images/tweet_this.gif[ /img][/url]
    
    PHP:
    to make two links, html for websites & BBcode for forums.
    it should also replace spaces with %20 for the BBcode to work in forums.
    maybe even some radio buttons to choose from different "tweet this" pics

    Ultimately I want to host the url shorting service for the tweets also, but that can wait.

    Thanks for any help or advice, Mike
     
    mikemason, Jun 23, 2009 IP
  2. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #2
    You're going to want to use the PHP function urlencode() to convert spaces to %20. To allow them to choose different "Tweet This" pictures, use Javascript to swap out the image code in your text area. Should be pretty straight forward :) If you have any problems, feel free to shoot me an IM or something.

    PS - Love the avatar :)

    Cheers
     
    Louis11, Jun 23, 2009 IP