You are here: Re: Import .TXT file contents into an HTML INPUT, PHP to the rescue? « All PHP « IT news, forums, messages
Re: Import .TXT file contents into an HTML INPUT, PHP to the rescue?

Posted by Rhonda on 09/16/05 18:30

"Hilarion" <hilarion@SPAM.op.SMIECI.pl> wrote in message
news:dgeneo$os9$1@news.onet.pl...
> >>> I'm trying to display a stored text document(number) as an Input on a
> >>> form.
> >>> I can display the number/value as follows using iframe:
> >>>
> >>> <iframe src="counter.txt" width="50" height="20" frameborder="0"
> >>> border="0"
> >>> scrolling="no" marginheight="0" marginwidth="0"></IFRAME>
> >>>
> >>> But I realize there is no way to source my Input field directly from
my
> >>> text
> >>> file.
> >>>
> >>> I must populate a named Input with my value for my PHP script to
process
> >>> it
> >>> with my other form fields.
> >>>
> >>> I was told this would be a job for PHP, but can't find a script this
> >>> specific.
> >>
> >> 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') ?>">
>
>
> Hilarion

Did either of your suggestions work for you? Or both?

 

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

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