posting form data to two scripts at once

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Norman Peelman

    #1

    posting form data to two scripts at once

    From: "Norman Peelman" <npeelman@cfl.r r.com>
    Subject: Re: posting form data to two php scripts at once
    Date: Sunday, December 17, 2006 12:06 AM

    <one.1more@gmai l.comwrote in message
    news:1166317725 .715320.309280@ 80g2000cwy.goog legroups.com...
    How do i post the form data to different php files at once. I tried the
    following code but it doesn't work. the data is sent only to the first
    php file.
    >
    <form method="post" action="insert. php" action="mail.ph p">
    Email<input type="text" name="email" value ="" size="20" />
    <input type="submit" value="submit" />
    </form>
    >
    >
    Is there a solution?
    >
    Yes, you just have to call the second script from the first. You could
    try:

    at the end of the first script---
    header("Locatio n:
    hxxp://your.domain.com/second_script.p hp?var1=$var1&v ar2=$var2");

    ....and then in the second script access the variables via $_GET['var1'] or
    $_REQUEST['var1'] etc. But then you more than likely need the second script
    to return back to the original page so you'll need another header() call
    from there.

    ....or you could use the 'curl' extension (almost same effect)

    ....or you could just incorporate the two scripts together. chances are this
    is your simplest solution.

    Norm
    --
    FREE Avatar hosting at www.easyavatar.com


  • seaside

    #2
    Re: posting form data to two scripts at once


    Norman Peelman schrieb:
    From: "Norman Peelman" <npeelman@cfl.r r.com>
    Subject: Re: posting form data to two php scripts at once
    Date: Sunday, December 17, 2006 12:06 AM
    >
    <one.1more@gmai l.comwrote in message
    news:1166317725 .715320.309280@ 80g2000cwy.goog legroups.com...
    How do i post the form data to different php files at once. I tried the
    following code but it doesn't work. the data is sent only to the first
    php file.

    <form method="post" action="insert. php" action="mail.ph p">
    Email<input type="text" name="email" value ="" size="20" />
    <input type="submit" value="submit" />
    </form>


    Is there a solution?
    >
    Yes, you just have to call the second script from the first. You could
    try:
    >
    at the end of the first script---
    header("Locatio n:
    hxxp://your.domain.com/second_script.p hp?var1=$var1&v ar2=$var2");
    Please note, that - using this method - you forward a GET request,
    which is
    restricted regarding the amount of data transferred. Moreover, you
    might need to
    change your PHP scripts to read $_POST and $_GET.

    Comment

    • Curtis

      #3
      Re: posting form data to two scripts at once

      A better idea might be to submit to the first script, which will then
      also use cURL or fsockopen to make the POST or GET request to the
      second script. You can even use SSL with the cURL library.


      Open Internet or Unix domain socket connection


      On Dec 17, 7:34 am, "seaside" <seaside...@mac .comwrote:
      Norman Peelman schrieb:
      >
      >
      >
      From: "Norman Peelman" <npeel...@cfl.r r.com>
      Subject: Re: posting form data to two php scripts at once
      Date: Sunday, December 17, 2006 12:06 AM
      >
      <one.1m...@gmai l.comwrote in message
      news:1166317725 .715320.309280@ 80g2000cwy.goog legroups.com...
      How do i post the form data to different php files at once. I tried the
      following code but it doesn't work. the data is sent only to the first
      php file.
      >
      <form method="post" action="insert. php" action="mail.ph p">
      Email<input type="text" name="email" value ="" size="20" />
      <input type="submit" value="submit" />
      </form>
      >
      Is there a solution?
      >
      Yes, you just have to call the second script from the first. You could
      try:
      >
      at the end of the first script---
      header("Locatio n:
      hxxp://your.domain.com/second_script.p hp?var1=$var1&v ar2=$var2");Ple ase note, that - using this method - you forward a GET request,
      which is
      restricted regarding the amount of data transferred. Moreover, you
      might need to
      change your PHP scripts to read $_POST and $_GET.

      Comment

      Working...