|
Posted by Hilarion on 09/16/05 19:45
>> >> >> 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.
>
> I placed:
>
> <input type="text" name="count"
> > value="<?php echo file_get_contents( 'counter.txt' ) ?>">
^ this ">" mark is probably a typo (because if you really
used it here, then you'd get the value stuff outside of
the input field).
> inside my HTML block. It yields:
>
> <?php echo file_get_contents( 'counter.txt' ) ?>
>
> inside the Input field box. Not the text file contents.
Which means that your webserver does not consider the document
to be PHP document and does not put in into PHP engine.
Maybe you have to change ".html" extension to ".php" or
maybe turn on the PHP module in the webserver.
Hilarion
Navigation:
[Reply to this message]
|