LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Include ssi in a form? (https://www.linuxquestions.org/questions/programming-9/include-ssi-in-a-form-321382/)

@ngelot 05-08-2005 02:51 PM

Include ssi in a form?
 
I would like to include a ssi-file in a form so that I only need to build one file and then copy it x times...

Something like:
Code:

<input type="text" name="T1" size="20"><!--#include virtual="T1.txt"-->
or
Code:

<textarea name="T1" cols="20" rows="1"><!--#include virtual="T1.txt"--></textarea>
If this is a part of my index-file I can copy the file to sevral directories where T1.txt contains different information....

Ex. /my-site/index.html include /my-site/T1.txt and /more/index.html includes /more/T1.txt while the index-file are actually the same - just copied to different directories...

How can I write the input/textarea-tag to include the info in the txt-file?

The reason to do this is to avoid making sevral index-files, but also to give the user the opportunity to change the input/textarea info and mail it to me with the form/post command...

Thanks!

david_ross 05-09-2005 12:57 PM

Just as you've done it.

If you want the text to be the value of the input field then:
<input type="text" name="T1" size="20" value="<!--#include virtual="T1.txt"-->">

@ngelot 05-11-2005 03:42 AM

Yepp!

My fault - I forgot a minute that this is a SERVER side command...

No wonder it wouldn't work in FrontPage....

Thanks!

You would not know how to get a single file printet out?

Something like:
Code:

<!--#include file="file.txt#line2" -->
so that only line 2 in file.txt is included on my page?

@ngelot

@ngelot 05-11-2005 03:42 AM

...a single LINE in a file....

@ngelot 05-11-2005 07:39 AM

Got help from another guy:
Code:

<!--#exec cmd="grep name text.txt | sed 's/name\ //g'" -->
This prints the line beginning with "name" in text.txt without printing "name" in the beginning of the output...

Works fine :-D

@ngelot


All times are GMT -5. The time now is 04:43 AM.