Results 1 to 6 of 6

Thread: Sending forms via post method

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default Sending forms via post method

    Hi,

    On my first page I have a simple form:

    PHP Code:
    <form action="page2.htm" method="post">
    <
    input type="text" name="firstname" />
    <
    input type="submit" />
    </
    form
    I want to print on "page2.htm" the value of the firstname.

    How can I do it?

  2. #2
    Join Date
    Oct 2011
    Location
    London
    Posts
    41
    Thanks
    19
    Thanked 1 Time in 1 Post

    Default

    <?php
    echo $_POST['firstname'];
    ?>

    and your in the wrong forum

  3. #3
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default

    I know how to do it in php but I don't want to use any server-side lagnuage

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    https://www.google.com/search?q=retr...+in+javascript

    Javascript cannot access post data because post data is sent directly to the server and is not part of the next page that loads.
    Javascript can access get data in the URL, although it is a little difficult to program (but see some examples in some of the discussions in those search results).
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by d-machine View Post
    I know how to do it in php but I don't want to use any server-side lagnuage
    Then there's little point in posting the form. What good will it do?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That's true-- you could do this using Javascript by not submitting the form. Copy the values of the inputs into variables then hide the form.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •