using variable variables with arrays please help!

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Tue Dec 31, 2002 7:00 am

If dynamic means for you from an URL to another, then it is already done.

When you go to a page and you send variables
for example:
mi_page.php?my_var1=26&my_var2=Joan

You can access them using this function:
echo $HTTP_GET_VARS["my_var1"]; (the same as $HTTP_GET_VARS[0] )
would output --> 26
echo $HTTP_GET_VARS["my_var2"]; (the same as $HTTP_GET_VARS[1] )
would output --> Joan

If you have sent those vars using a form and the POST method, then you'll have to use this -->

echo $HTTP_POST_VARS["my_var1"];
would output --> 26
echo $HTTP_POST_VARS["my_var2"];
would output --> Joan

I hope you meant that... :)
otherwise try again ;)

bye!

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Post by Oleg Butuzov » Tue Dec 31, 2002 7:12 am

or use $_GET or $_POST arrays =)

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Post by Oleg Butuzov » Wed Jan 01, 2003 11:46 pm

Code: Select all

<?php
$test="This is test";
$b="test";
$a=${$b};

echo $a;
?>

output "This is test"

Post Reply

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest