print correct values for variables inside variebles ..
| From: | hsmith at twilyt dot com | Date: | Wed, 31 Jan 2001 13:58:24 +0000 |
| Subject: | print correct values for variables inside variebles .. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37477@lists.php.net to get a copy of this message | ||
I've posted a similar question .. and got hat one resolved .. but now I'ms trugling with
this one ..
I have a page called edit .. that I pass a variable called $page like this
edit.php3?page=index
what I'm trying is something like this ..
function blah($page){
$query="select * from site_${page}_html";
if ($result=$this->db_query($query)){
$row=$this->db_fetch_array($result);
$$page_heading=$row["${page}_heading"];
$$page_desc=$row["${page}_desc"];
$$page_content=$row["${page}_content"];
<formstuff here>
<input type=\"text\" size=\"30\" name=\"${page}_heading\"
value=\"$$page_heading\">
</formstuff here>
}else{
die("horrably");
}
}
$$page_heading seems to work fine since ${$page}_heading and $${page}_heading gives my syntx errors
while storing the data
while printing ${page}_heading displays the name I want .. I can't get the data out of
$$page_heading to display
rather is shows "$" as $$page_heading, "_heading" as ${$page}_heading,
"$contact_heading" as $${page}_heading
any help would be appreaciated .. thanks
Henti