You are here: Re: html within php works, but php within html doesnt « PHP Programming Language « IT news, forums, messages
Re: html within php works, but php within html doesnt

Posted by Phil on 09/02/06 14:12

mantrid wrote, On 3/09/06 1.19 a:
> echo "<option value='$noticia[TopicID]'>$noticia[Topic]</option>";

The problem is in the way that you reference the $noticia array. In your
first example, you a double-quoted string, this causes PHP to
automatically grab the value from the array, but in your second example...

> <option value="<?php $noticia[TopicID]; ?>"><?php $noticia[Topic];

You don't. You'll need to give it the key of the array as a string, like
$noticia['TopicID']

When using double-quoted strings, something like "$array[key]" will grab
the variable $array['key'], unless you use curly-braces like
"{$array['key']}".

See:
<http://nz.php.net/manual/en/language.types.string.php#language.types.string.parsing.simple>

-Phil

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация