Results 1 to 9 of 9

Thread: Passing Data from one PHP file to another

  1. #1
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Passing Data from one PHP file to another

    My PHP file

    Code:
    <?php
      $email = $_REQUEST['EMail'] ;
      $first = $_REQUEST['FirstName'] ;
      $last = $_REQUEST['Name'];
      $try = $_REQUEST['Name'];
      $RegistrationFormID = $_REQUEST['RegistrationFormID'];
      $key = $_REQUEST['key'];
    
      $message = "name: " $first  $last "\n email: " $email;
    
      mail( "yourname@example.com", "New Subscriber",
        $message, "From: $email" );
      header( "Location: http://www.example.com/thankyou.html" );
    ?>
    While I only have a little bit of info going to my email address, I would like the rest to go to a script that adds it to a database. located at http://www.decisionfacilitation.com/tinc (i don't have the name of the file).

    How would I do this?

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Code:
    $insert = "INSERT INTO tableName(id,email,first,last,key) VALUES(". $RegistrationFormId .", ". $email .", ". $first .", ". $last .", ". $key .")";
    
    if( !mysql_query($insert) )
    {
         echo "Upload Failed";
    }

  3. #3
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    unfortunately, I don't have access to the database nor do I know how it is setup. Which I why I need to pass the information to a second script which in turn passes the information to the database.

    Do you know how to do that?

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    do you have control over what you update? because if you do not have control over updating something then this is impossible.

    If you do have control which is sounds like you have very limited access, then you just need to find the appropriate terminology and functions to update the data; at a first glance that is what you are asking for.

    You say you pass it to another script, what is the script? how do you determine what to update and where... if you can answer those things then we can help you, if you cannot, then that is something you need to obtain.

    we can, and are very willing to help with the technical aspect however, if you dont give us the correct ingredients its like trying to make cookies without the raw batter, just not possible.

  5. #5
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    ok, I am using a newsletter system that my host has.

    I have a form at http://www.decisionfacilitation.com/...onFormID=19678
    which is given to me by the newsletter system.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:exslt="http://exslt.org/common" xmlns:edyn="http://exslt.org/dynamic" xmlns:estr="http://exslt.org/strings" xmlns:admin="http://www.schlund.de/tinc/admin" xmlns:guest="http://www.schlund.de/tinc/guest" xmlns:menu="http://www.schlund.de/tinc/menu" xmlns:gen="http://www.schlund.de/tinc/general" xmlns:var="http://www.schlund.de/tinc/variables" xmlns:cpn="http://www.schlund.de/tinc/components" xmlns:dyn="http://www.schlund.de/tinc/dynpages" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pmtns="http://schemas.schlund.de/pmt">
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link href="http://www.decisionfacilitation.com/spicons/tinc/oaoconfig_us/newsletter/style/index.css" rel="stylesheet" type="text/css" /></head>
    <body>
    <form action="http://www.decisionfacilitation.com/tinc" method="post" accept-charset="utf-8">
    <input type="hidden" name="try" value="true" />
    <input type="hidden" name="RegistrationFormID" value="19678" />
    <div class="box">
    <input type="hidden" name="key" value="YrUz9HAQ" />
    <h1>Subscribe</h1>
    <table cellpadding="2" cellspacing="1">
    <tr class="message"><td colspan="2"><div>Please make sure all fields are filled in. Those marked with a star are mandatory.</div></td></tr>
    <tr class="high  mandatory"><td class="title">
        E-mail:
      <strong> *</strong></td><td><input type="text" name="EMail" class="text" size="15" value="" /></td></tr>
    <tr class="low"><td class="title">
        First name:
      </td><td><input type="text" name="FirstName" class="text" size="15" value="" /></td></tr>
    <tr class="high"><td class="title">
        Last name:
      </td><td><input type="text" name="Name" class="text" size="15" value="" /></td></tr>
    <tr style="vertical-align:bottom"><td style="text-align:left"><a href="http://www.decisionfacilitation.com/tinc?key=CK8DcT9i&amp;RegistrationFormID=19678">Unsubscribe</a></td><td colspan="2"><input type="submit" class="submit" style="float:right" value="Subscribe" /></td></tr>
    </table></div></form>
    </body>
    </html>
    Now the problem I have is that the system does not notify me when I have new subscribers.

    So I want to setup a way that I get an email saying that some person with some email address just subscribed.

    As far as I know, I would need to take the form and change it so that the data is passed to a script that would do the emailing for me and then continue the journey to tinc (whatever that is).

    so if I change
    Code:
    <form action="http://www.decisionfacilitation.com/tinc" method="post" accept-charset="utf-8">
    to
    Code:
    <form action="form.php" method="post" accept-charset="utf-8">
    Then I just need to setup form.php

    Code:
    <?php
      $email = $_REQUEST['EMail'] ;
      $first = $_REQUEST['FirstName'] ;
      $last = $_REQUEST['Name'];
      $try = $_REQUEST['Name'];
      $RegistrationFormID = $_REQUEST['RegistrationFormID'];
      $key = $_REQUEST['key'];
    
      $message = "name: " $first  $last "\n email: " $email;
    
      mail( "yourname@example.com", "New Subscriber",
        $message, "From: $email" );
      header( "Location: http://www.example.com/thankyou.html" );
    ?>
    But all this data needs to be forwarded to tinc (which I still don't know what that is)
    Last edited by SawnDiddle; 12-11-2007 at 09:36 PM.

  6. #6
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Put this at the bottom of form.php

    Code:
    <form action="http://www.decisionfacilitation.com/tinc" method="post" accept-charset="utf-8" name="form111" id="form111">
    <input type="hidden" name="EMail" value="$_REQUEST['EMail']">
    <input type="hidden" name="FirstName" value="$_REQUEST['FirstName']">
    <input type="hidden" name="Name" value="$_REQUEST['Name']">
    <input type="hidden" name="try" value="$_REQUEST['try']">
    <input type="hidden" name="RegistrationFormID" value="$_REQUEST['RegistrationFormID']">
    <input type="hidden" name="key" value="$_REQUEST['key']">
    
    function ()
    {document.form111.submit();}
    </form>
    Also,$try = $_REQUEST['Name']; should be $try = $_REQUEST['try'];
    Last edited by Fuzzydude45; 12-14-2007 at 02:53 AM.

  7. #7
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    thank you,

    function ()
    {document.form111.submit();}

    does that need to be placed in javascript codes?

    EDIT:

    i tried the above and put in the function () in javascipt b/c it looked like that is what it was from the searches I did with google. (otherwise it would show up as text on the page).
    Unfortunately, the data wasn't placed in the system in the backend and also my whole control panel got screwed up and I had to contact tech support to fix it.
    Last edited by SawnDiddle; 12-14-2007 at 04:03 PM.

  8. #8
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Does anyone know what I did that screwed up the system?

  9. #9
    Join Date
    Jun 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <?php
    $email = $_REQUEST['EMail'] ;
    $first = $_REQUEST['FirstName'] ;
    $last = $_REQUEST['Name'];
    $try = $_REQUEST['Name'];
    $RegistrationFormID = $_REQUEST['RegistrationFormID'];
    $key = $_REQUEST['key'];

    $message = "name: " $first $last "\n email: " $email;

    mail( "yourname@example.com", "New Subscriber",
    $message, "From: $email" );
    /*---------- This is a better way of doing it rather than using javascript
    ------------ Its not a good idea to pass confidential data like password etc
    ------------ since it use the get method
    */
    header( "Location: http://www.example.com/thankyou.html?EMail=$email&FirstName=$first&Name=$last" );
    ?>

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
  •