By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

change string into variable

P: n/a
when going to index.php?headlines=Macsanomat

i want to use the $Macsanomat instead of Macsanomat (the string)
this is needed to declare $Macsanomat into a loop.
piece of the code:
//------
$Macsanomat['naam'] = "Macsanomat";
$Macsanomat['vlag'] = '<img src="finland.gif>';
$Macsanomat['tekst'] = "<b>News</b> powered by ";
$Macsanomat['id'] = '714';

if ($headlines !="")
{
echo $headlines['vlag'].'<a
href="'.$headlines['id'].'>'.$headlines['naam'].</a>';
};
//-------

index.php?headlines=Macsanomat

in the last line $headlines['vlag'] should be <img src="finland.gif>,
$headlines['id'] should be 714. The value of both is now simply M
anyone ?
--
http://bluap.nl
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
BluaP <sp**@bluap.nl> wrote:
when going to index.php?headlines=Macsanomat

i want to use the $Macsanomat instead of Macsanomat (the string)
this is needed to declare $Macsanomat into a loop.

piece of the code:
//------
$Macsanomat['naam'] = "Macsanomat";
$Macsanomat['vlag'] = '<img src="finland.gif>';
$Macsanomat['tekst'] = "<b>News</b> powered by ";
$Macsanomat['id'] = '714';

if ($headlines !="")
{
echo $headlines['vlag'].'<a
href="'.$headlines['id'].'>'.$headlines['naam'].</a>';
};


Have a look at the manual:
http://uk.php.net/manual/en/language...s.variable.php

HTH;
JOn
Jul 16 '05 #2

P: n/a
Jon Kraft <jo*@jonux.co.uk> wrote:
BluaP <sp**@bluap.nl> wrote:
when going to index.php?headlines=Macsanomat

i want to use the $Macsanomat instead of Macsanomat (the string)
this is needed to declare $Macsanomat into a loop.

piece of the code:
//------
$Macsanomat['naam'] = "Macsanomat";
$Macsanomat['vlag'] = '<img src="finland.gif>';
$Macsanomat['tekst'] = "<b>News</b> powered by ";
$Macsanomat['id'] = '714';

if ($headlines !="")
{
echo $headlines['vlag'].'<a
href="'.$headlines['id'].'>'.$headlines['naam'].</a>';
};


Have a look at the manual:
http://uk.php.net/manual/en/language...s.variable.php

HTH;
JOn


sure did help!
plain simple:

if ($headlines !="")
{
$headlines2=$$headlines;
echo $headlines2['vlag'].'<a
href="'.$headlines2['id'].'>'.$headlines2['naam'].</a>';
};

did not know the $$ trick. thank you, thank you!
--
http://bluap.nl
Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.