View Full Version : Passing Data from one PHP file to another
SawnDiddle
12-10-2007, 08:17 PM
My PHP file
<?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?
boogyman
12-10-2007, 08:46 PM
$insert = "INSERT INTO tableName(id,email,first,last,key) VALUES(". $RegistrationFormId .", ". $email .", ". $first .", ". $last .", ". $key .")";
if( !mysql_query($insert) )
{
echo "Upload Failed";
}
SawnDiddle
12-11-2007, 03:55 PM
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?
boogyman
12-11-2007, 04:27 PM
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.
SawnDiddle
12-11-2007, 09:24 PM
ok, I am using a newsletter system that my host has.
I have a form at http://www.decisionfacilitation.com/tinc?key=YrUz9HAQ&RegistrationFormID=19678
which is given to me by the newsletter system.
<!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&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
<form action="http://www.decisionfacilitation.com/tinc" method="post" accept-charset="utf-8">
to
<form action="form.php" method="post" accept-charset="utf-8">
Then I just need to setup form.php
<?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)
Fuzzydude45
12-14-2007, 02:43 AM
Put this at the bottom of form.php
<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']; :)
SawnDiddle
12-14-2007, 07:46 AM
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. :(
SawnDiddle
12-16-2007, 06:07 PM
Does anyone know what I did that screwed up the system?
Blokeish
06-27-2008, 04:31 AM
<?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" );
?>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.