How to code the following program ?

Discussion in 'PHP' started by i'm, Jul 30, 2010.

  1. #1
    Hello Everyone,

    I have 1 textbox and a button in one form ..Now i want to make it in such a way that

    when he clicks the button it should go to http://mysite.com/file.php?=ENTERED+TEXT

    and in that page (http://mysite.com/file.php?=ENTERED+TEXT) there should be a frame with its source as ie. (src="http://anotherblog.com/ENTERED+TEXT+referrer")..So how do i do that ?

    Please help me !

    Thank you..Contact me @ tch5416339@hotmail.com! I'm also willing to pay if you can help me out !
     
    i'm, Jul 30, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    I'm a bit confused by your request so here's two examples, the first one will put the comments entered from the text box into the address bar, along with the referer page from which the user came from.

    
    <?php
    
    $referer = urlencode($_SERVER['HTTP_REFERER']);
    
    echo "
    
    <form action=file.php method=get>
    
    Comments:<br>
    <textarea name=comments cols=40 rows=6></textarea>
    <input name=referer type=hidden value=$referer>
    
    <P><input type=submit value=submit>
    
    </form>
    ";
    
    ?>
    
    PHP:
    file.php will simple echo out the address.
    
    <?php
    
    $referer = $_GET['referer'];
    
    $comments = urlencode($_GET['comments']);
    
    echo "http://mysite.com?file.php?comments=$comments","+","$referer";
    
    ?>
    
    PHP:
    The second example will only echo out the address leaving the url intact in the address bar.

    
    <?php
    
    $referer = urlencode($_SERVER['HTTP_REFERER']);
    
    echo "
    
    <form action=file.php method=post>
    
    Comments:<br>
    <textarea name=comments cols=40 rows=6></textarea>
    <input name=referer type=hidden value=$referer>
    
    <P><input type=submit value=submit>
    
    </form>
    ";
    
    ?>
    
    PHP:
    file.php
    
    <?php
    
    $referer = $_POST['referer'];
    
    $comments = urlencode($_POST['comments']);
    
    echo "http://mysite.com?file.php?comments=$comments","+","$referer";
    
    ?>
    
    PHP:
    The difference is POST & GET

    You should also not that you need use urlencode() and or urldecode() when you wish to view the url.

    example for either method: using GET or POST
    
    $referer = urldecode($_GET['referer']);
    $comments = urldecode($_GET['comments']);
    
    PHP:
    Anyway.. if its any thing else you need, just reply with more details and a full example of your requirements.
     
    MyVodaFone, Jul 30, 2010 IP
  3. i'm

    i'm Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The first code does nothing..nothing happnes when i click on submit !
     
    i'm, Jul 30, 2010 IP
  4. i'm

    i'm Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Nothin happens when i try any of the codes !!1
     
    i'm, Jul 30, 2010 IP
  5. i'm

    i'm Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    And my question is no where related to ur answer :(
     
    i'm, Jul 30, 2010 IP
  6. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #6
    Theres no need to spam the forum with 3 replies, you have several hours to edit your post.

    Where are you putting the code, supply a url please or as requested explain yourself better with an example so there's no misunderstandings.
     
    MyVodaFone, Jul 30, 2010 IP
  7. hauntin

    hauntin Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hey come on, say what is your requirement clearly. So that everyone can help you
     
    hauntin, Jul 30, 2010 IP
  8. i'm

    i'm Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Add me @ ! I'll pay you for helping !!
     
    i'm, Jul 31, 2010 IP