I am writing a routine for a point of sale system in a shop. They have a fairly simple and short stock list which fits on one screen. The user selects how many of an item they wish to sell and a JavaScript routine calculates the totals. I then POST this form to another PHP program where it needs to recover the information to print a receipt.
The problem is the JavaScript routine has some unusual PHP variable names which my program is auto building based on a flat file database.
To cut a long story short let's say one of my variables is called $PROD_KAY001_499 and it contains the value 2 which is the quantity the user entered.
If I say: echo $PROD_KAY001_499; it shows 2. No problem.
But what if I need to build that variable? Let's say I just did that and now $temp=$PROD_KAY001_499.
If I say: echo $temp; it shows '$PROD_KAY001_499' but I want to show the CONTENT of that variable, not the actual variable name itself.
Sorry if that was not all that clear, it's hard to explain...
2007-04-21
15:38:31
·
5 answers
·
asked by
ZCT
7
in
Computers & Internet
➔ Programming & Design
I am importing all variables from my other program with @import_request_variables.
Like I said if I manually plug the variable name into an echo statement it shows just fine. The problem is I am trying to take the variable name out of $temp.
So $temp contains the name of my variable, I just want to know the contents of the variable defined in $temp.
2007-04-21
17:05:04 ·
update #1
dhvrm,
Thanks, but I am using a routine to calculate the variable in question.
So for example:
$temp = '$PROD_'.$anothervariable.'_005';
So now I know what the variable name is the content of $temp.
But I want to find the content of $PROD_etc etc.
Again, sorry for the bad explanation of this problem.
2007-04-21
18:32:00 ·
update #2