Reply to Re: Import .TXT file contents into an HTML INPUT, PHP to the rescue?

Your name:

Reply:


Posted by Hilarion on 09/16/05 18:40

>> >> A couple ways to do it. THis should work:
>> >>
>> >> <input type=:"text" name="count"
>> >> value="<?=file_get_contents('counter.txt')?>">
>> >>
>> >> You may have to use use trim() to remove linefeeds or spaces:
>> >> <?=trim(file_get_contents('count.txt'))?>
>> >
>> > I tested: <input type=:"text" name="count">
>> > value="<?=file_get_contents('counter.txt')?>">
>> >
>> > It produced this in the form's Input box:
>> > <?=file_get_contents('counter.txt')?>
>>
>>
>> Which means that you have ASP-style tags turned off (or short
>> tags turned off) and will have to expand it to:
>>
>> <input type=:"text" name="count">
>> value="<?php echo file_get_contents('counter.txt') ?>">
>>
>
> Did either of your suggestions work for you? Or both?


Why do you ask? Do they work for you?


Not tested any of them now, but I know all those work
(in general) in my PHP.
The error in the code above is that the <input> tag got
closed before "value" attribute and that there's ":"
before "=" at the "type" attribute. Which means that
this one you should use:

<input type="text" name="count"
value="<?php echo file_get_contents( 'counter.txt' ) ?>">

You may also look at my other post.


Remember that this should be inside HTML block, not
inside PHP block.


Hilarion

PS.: If your PHP version does not have "file_get_contents"
function, then you could combine "file" and "implode"
to replace it like this:
implode( '', file( 'counter.txt' ) )

[Back to original 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

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