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]
|