SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to pass value of one page's textbox to another page's textbox ?

    Hi Friends,

    I have one requirement where I have one textbox & submit button, when I click that button by filling value on that textbox I need it will redirect to different page & the value of that textbox automatically come into this page textbox. If any one have any idea kindly help me.


    Regards,
    Premashish

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Trivially you could accomplish this using the GET method for your form, and do a redirect using
    PHP Code:

    // your script must output nothing up to this stage
    header("Location: /newurl.php?tbox=" $_GET['tbox]);
    exit(); 
    That has limitations about the size of the amount of text you can use, and some would consider it as ugly.

    Then you could just make the new script the target of your form, using the POST method to that new script then show the text that had been entered

    existingurl.php
    Code:
    <form method=POST action=newurl.php>
    newurl.php
    PHP Code:

    <textarea><?php echo $_POST['tbox']; ?></textarea>
    You could use a session variable to remember the text box data and then repopulate the form in the next page.


    ** You'd need to add some html escaping on these examples in order to protect users.


Bookmarks

Posting Permissions

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