Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2009
    Posts
    47

    Urgen Help Needed in form output.

    Hello!
    I have written a code that will give set of keywords as an output after doing several action in the following format

    xyz.com/test.php?keywords=sdakasd%0D%0Akhjawer%0D%0hgjhsjasg%0D%0hjkhsue

    I want to convert the format of the same to

    xyz.com/test.php?search=name&keywords=sdakasd%0D%0Akhjawer%0D%0hgjhsjasg%0D%0hjkhsue

    Due to limitation in code i'm unable to achieve output as required.

    Is there any way to read the same in test1.php and this test1.php will give output in required format.

    Please guide.
    Last edited by jainritesh; 04-13-2011 at 07:27 AM.
    Ritesh Jain

  2. #2
    Join Date
    Jul 2009
    Posts
    47
    With Following Code in test1.php

    PHP Code:
    <?php
    $keywords 
    $_POST['keywords'];
    ?>
    <a href="xyz.com/test2.php?search=name&keywords=<?php echo $keywords?>">Test Page 2</a>
    I'm getting output as

    xyz.com/test2.php?search=name&keywords=sdakasdAkhjawerhgjhsjasghjkhsue

    as against

    xyz.com/test2.php?search=name&keywords=sdakasd%0D%0Akhjawer%0D%0hgjhsjasg%0D%0hjkhsue

    Where am i getting wrong
    Ritesh Jain

  3. #3
    Join Date
    Jan 2006
    Location
    Athens, Greece
    Posts
    1,479
    You just need to urlencode() the POST variable

  4. #4
    Join Date
    Apr 2011
    Posts
    34
    PHP Code:
    <?php
    $keywords 
    $_POST['keywords'];
    $keywords_clean urlencode($keywords);
    ?>
    <a href="xyz.com/test2.php?search=name&keywords=<?php echo $keywords_cleans?>">Test Page 2</a>
    incase you did not understand

  5. #5
    Join Date
    Jul 2009
    Posts
    47
    Thanks steve_arm and motters for quick help.

    Lastly how can i redirect to the new formatted url automatically for further action instead of requirement of manual clicking?

  6. #6
    Join Date
    Apr 2008
    Posts
    306
    PHP Code:
    <?php

    $keywords 
    urlencode($_POST['keywords']);
    header("Location: test2.php?search=name&keywords={$keywords}");
    Heymman - Beefy servers, tiny price !

  7. #7
    Join Date
    Apr 2011
    Posts
    34
    woot beat me to it lol as simple as above orrr you could use javascript to redirect them though i think using php header is the best way

    if you are using multiply headers in you page remember to add
    PHP Code:
    ob_start(); 
    at the top of the page

    :p

  8. #8
    oh thanks, was in search of correct syntax to use urlencode() function.

  9. #9
    Join Date
    Jul 2009
    Posts
    47
    thanks everybody for quick support.

Similar Threads

  1. Online Form and Output Layout
    By Yujin in forum Web Design and Content
    Replies: 10
    Last Post: 08-15-2010, 01:48 AM
  2. Confirmable form script with nice output
    By dxer in forum Programming Discussion
    Replies: 2
    Last Post: 05-06-2007, 05:29 PM
  3. Urgen help needed
    By gavin101 in forum Dedicated Server
    Replies: 4
    Last Post: 01-02-2007, 10:18 AM
  4. formmail or similar, to output form data to flat text file???
    By kenop in forum Programming Discussion
    Replies: 3
    Last Post: 11-22-2005, 01:16 PM
  5. Client wants specific form output
    By wtid in forum Web Hosting
    Replies: 8
    Last Post: 07-31-2001, 01:53 AM

Posting Permissions

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