Re: inserting php value in html shorter wayand downloading winword & mp3 files the fancy way

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 24, 2009 at 05:56:46PM +0200, Grega Leskov??ek wrote:

> Hi, I am still a newbie in php. Is there a shorter way to include a php
> value in a form?
> <input type="text" name="fullname" size="40" value="<?php echo
> {$user['fullname']}; ?>" />
> is it possible to do smth like this <?=php {$user['fullname']}; ?> like in
> JSP?
> Can I omit the last whitespace before the closing ?> ?

Yes, you can include a PHP value in a script. Like this:

...size="40" value="<?php echo $user['fullname']; ?>" />

Your curly braces are redundant, and you must quote the "fullname" index
if you're not quoting the whole $user['fullname'] expression. Yes, you
can remove the final space after $user['fullname']; and before the tag
closure (?>). But there's no reason to.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux