473,466 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help with setting variables

hello all,
this is some code that i am using that "loops" through all of the variables
that paypal
ships back to me via ipn.

for ($x=0; $x < count($postvars); $x++)
{ $y=$x+1;
$postkey = $postvars[$x];
$postval = $$postvars[$x];
$postipn.= "&" . $postkey . "=" . urlencode($postval);
$mailipn.= $postkey . " = " . $postval . "\r\n";
}

i then email myself a copy of $mailipn and it contains everything i need.
that part works fine.
however, is it possible to set a variable using the names that were
returned.
for example, paypal sends me back "business", so i would like to set the
value of $business
equal to the value from the paypal post.

normally i would do this:
@$business = $_POST['business'];
but since there are quite a few variables, and the names change (i.e.
shopping carts, etc.)
i would like to set them using the loop posted above (it returns them all).

using the loop above, the "business" line looks like this when echoed:
business = my********@paypal.com

so you see, it would nice to make a $business variable for later use in the
script
that contained my********@paypal.com

thanks.
Jul 16 '05 #1
4 3707
"fartsniff" <fa**@sniff.com> wrote in message news:<vg************@corp.supernews.com>...
hello all,
this is some code that i am using that "loops" through all of the variables
that paypal
ships back to me via ipn.


paypal_post_vars_in_str = "";
foreach($paypal_post_arr as $key=>$value)
{
$value = urlencode(stripslashes($value));
paypal_post_vars_in_str .= "&$key=$value";
}

If you need the value of "business", you may use like
$paypal_post_arr['business']

---
"I have a dream that one day girls will be measured by the size of
their brains than the shape of their flush"
Email: rrjanbiah-at-Y!com
Jul 16 '05 #2
thank you for your help.

"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in message
news:ab**************************@posting.google.c om...
"fartsniff" <fa**@sniff.com> wrote in message

news:<vg************@corp.supernews.com>...
hello all,
this is some code that i am using that "loops" through all of the variables that paypal
ships back to me via ipn.


paypal_post_vars_in_str = "";
foreach($paypal_post_arr as $key=>$value)
{
$value = urlencode(stripslashes($value));
paypal_post_vars_in_str .= "&$key=$value";
}

If you need the value of "business", you may use like
$paypal_post_arr['business']

---
"I have a dream that one day girls will be measured by the size of
their brains than the shape of their flush"
Email: rrjanbiah-at-Y!com

Jul 16 '05 #3
R. Rajesh Jeba Anbiah wrote:
"fartsniff" <fa**@sniff.com> wrote in message news:<vg************@corp.supernews.com>...
hello all,
this is some code that i am using that "loops" through all of the variables
that paypal
ships back to me via ipn.

paypal_post_vars_in_str = "";
foreach($paypal_post_arr as $key=>$value)
{
$value = urlencode(stripslashes($value));
paypal_post_vars_in_str .= "&$key=$value";
}

If you need the value of "business", you may use like
$paypal_post_arr['business']


Going one step further by using PHP's Variable Variables, you could do this:
<?
while (list($key, $val) = each($paypal_post_arr)) {
$$key = $val;
// ^^ - using a variable variable
}
?>

which results in $business being equal to whatever the actual value is.
The only problem is that you have to know what all the variable names
are in order to access them.

Jason
Jul 16 '05 #4

On 4-Jul-2003, "fartsniff" <fa**@sniff.com> wrote:
hello all,
this is some code that i am using that "loops" through all of the
variables
that paypal
ships back to me via ipn.

for ($x=0; $x < count($postvars); $x++)
{ $y=$x+1;
$postkey = $postvars[$x];
$postval = $$postvars[$x];
$postipn.= "&" . $postkey . "=" . urlencode($postval);
$mailipn.= $postkey . " = " . $postval . "\r\n";
}

i then email myself a copy of $mailipn and it contains everything i need.
that part works fine.
however, is it possible to set a variable using the names that were
returned.
for example, paypal sends me back "business", so i would like to set the
value of $business
equal to the value from the paypal post.

normally i would do this:
@$business = $_POST['business'];
but since there are quite a few variables, and the names change (i.e.
shopping carts, etc.)
i would like to set them using the loop posted above (it returns them
all).

using the loop above, the "business" line looks like this when echoed:
business = my********@paypal.com

so you see, it would nice to make a $business variable for later use in
the
script
that contained my********@paypal.com


http://www.php.net/manual/en/function.extract.php

--
Tom Thackrey
www.creative-light.com
Jul 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mydejamail | last post by:
Coming from an objectpascal background with strict type checking, I am being driven nuts by PHP. Stuff like using variables without declaring them, case sensitivity of variables, getting true,...
5
by: arber | last post by:
Hi, I wrote a C++ program(Using VC 6.0). It's run well under debug environment. After i finished it and made a release version. The different results are outputed. Anybody have this...
8
by: David McDivitt | last post by:
I need to set tabs on java generated pages. Pages have four sections: header, sidebar, body, and footer. The sidebar and body change dynamically. The tab key must go to anchors, fields, and buttons...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
2
by: Hexman | last post by:
Hello All, Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in my update statement and when trying...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
8
by: Eddie | last post by:
I am having difficulty in setting variables in a session, and then accessing those variables throughout the web pages that they click on. After having them set a user name and password,...
4
by: daxco21 | last post by:
I have been working on this simple project for a week, and come to the point where I feel like I need outside help. For the life of me I can't figure out what is wrong with this "sellIceCream(...)"...
1
by: Speebs | last post by:
Hello, I have a little form that people can fill out to generate CD labels from an RTF template. The template basically contains variables that are replaced by the text typed into the form. ...
6
by: xhe | last post by:
I am using ffmpeg to convert video, this is a sample script: $str='/home/transla1/bin/ffmpeg -i /home/transla1/public_html/ cybertube/web/uploads/video/31_AK000005.AVI -s 240x180 -b 100k -ar...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.