Results 1 to 5 of 5

Thread: Response of a PHP form in variable

  1. #1
    Join Date
    Aug 2009
    Posts
    51

    Response of a PHP form in variable

    I will explain my problem:

    I have a php page that offers a form of this type <forms action="login.php" method="post"> "

    I would like to have the response of this form of login.php page in a variable, is this possible?

    A diagram:
    Page 1 => send form => Page 2
    Page 2 => dispatch resp. => Page 1
    Page 1 => Backup page.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Response of a PHP form in variable

    Use session. PHP Session consists of a way to preserve certain data across subsequent accesses. This enables you to build customized applications and increase the appeal of your web site. Session handling was added in PHP 4.0.0 and so if you are having version 4.0 then it would be best option for you. For more information: http://www.php.net/manual/en/intro.session.php

  3. #3
    Join Date
    Aug 2009
    Posts
    51

    Re: Response of a PHP form in variable

    Page 1 => send form => Page 2
    Page 2 => dispatch resp. => Page 1
    Page 1 => Backup page.

    in fact I have a whole list of parameters, and what I want to do is my top number 1 transfer form with each parameter one by one and saves the response on Page 2 in a file.

    without displaying page 2 if possible and all automatically without clicking anywhere

    is this possible given that I just do not change on page 2?

  4. #4
    Join Date
    May 2008
    Posts
    685

    Re: Response of a PHP form in variable

    What is the response to page2? Is this an HTML page and want to recover the code? I recommend you always Ajax's jQuery for this type of coding.

    Syntax

    Code:
    jQuery.post( url,[data],[callback],[type])
    Description:

    Load a remote page using an HTTP POST request.

    This is an easy way to send a simple POST request to a server without having to use the more complex $.ajax function. It allows a single callback function to be specified that will be executed when the request is complete (and only if the response has a successful response code).

    The returned data format can be specified by the fourth parameter. If you need to have both error and success callbacks, you may want to use $.ajax. $.post is a (simplified) wrapper function for $.ajax.

    $.post() returns the XMLHttpRequest that it creates. In most cases you won't need that object to manipulate directly, but it is available if you need to abort the request manually.
    Check a few examples, I think it may interest you.

  5. #5
    Join Date
    Aug 2009
    Posts
    51

    Re: Response of a PHP form in variable

    So if I understood in my page1.php, I have to code for example:

    HTML Code:
    $.post("page2.php", 
        {  accountName: "conte1", 
         password: "azerty" 
     }, 
       function(data){ 
         alert("Data Loaded: " +  data); 
       } 
     );
    or I have created the form in html and the script will handle the post and returned to me the answer?

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. Replies: 2
    Last Post: 02-05-2011, 07:06 AM
  3. Replies: 2
    Last Post: 28-08-2009, 07:51 PM
  4. Replies: 3
    Last Post: 25-04-2009, 11:34 AM
  5. Problem reloading MDI child form in main form.
    By AFFAN in forum Software Development
    Replies: 3
    Last Post: 30-01-2009, 09:05 PM

Tags for this Thread

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
  •  
Page generated in 1,715,676,238.38598 seconds with 16 queries