Forum Moderators: coopster

Message Too Old, No Replies

Problem echoing variables

         

RandGuy

3:26 pm on May 26, 2004 (gmt 0)

10+ Year Member



Im having a problem with a form script on my site, it grabs information from a database - this information is then echoed into a form. Each time I create a price_ variable and generate a number on to the end (e.g price_0,price_1) and this adds one each time. Now thats fine, but on the page that processes these variables I tried the following to display the price...

$price = "price_" . $i;

This doesnt work, so how would I dynamically create the right variable and be able to display it. I hope I explained it right, arrays arent an option, Im just looking for a solution to this current setup.

RandGuy

3:46 pm on May 26, 2004 (gmt 0)

10+ Year Member



Nevermind... The following works...

$HTTP_POST_VARS[$num]

jatar_k

4:41 pm on May 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld RandGuy,

if your php version is > 4.1.0 you should use $_POST instead of $_HTTP_POST_VARS, this page may help in the future

PHP Predefined Variables [ca.php.net]