Jump to content

Archived

This topic is now archived and is closed to further replies.

HuggieBear

Possible Interpolation *SOLVED*

Recommended Posts

I think this is an interpolation question but I'm not sure.

I have the following code, now I know the code's not ideal, but I'm putting it like this so I can learn.

[code=php:0]
<?php
$fruit = $_GET['fruit'] // The value of 'fruit' is going to be a text string passed from a form of either "$apple" or "$grape"
$apple[]="red";
$apple[]="green";
$grape[] = "purple";
$grape[] = "green";

foreach ($var as $colour){ // how can I make $var whatever the value of $fruit is I guess I need to interpolate the variable
  echo $colour;
}
?>
[/code]

I hope this made sense.

Regards
Rich

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.