Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using SSI with Perl

Status
Not open for further replies.

inforeqd

Technical User
Jan 8, 2001
95
US
I have SSI enabled on my Apache. I've successully created a simple SSI using a perl script that queries a "server" for current settings. The current settings that I queried for are then posted to a webpage.

I would however like to be able to post these current settings into an editable text box. How can I get the output into a text box verse just plain text/html on a webpage.

Ultimately I'd like to be able to backspace/delete out the reported text, change it, and then submit that to the remote server. However I'll deal with this portion later unless anyone has some ideas/suggestions on how to do this.

TIA
inforeqd
 
inforeqd, your problem is somewhat vague, but that's not the major problem here I think.

Based on how you worded your question and your stated goal, it's probably safe to say you are a beginner. Cool. Tek-Tips is the place to be. In order to help you out, I think a little more info is needed.

How familiar are you with HTML?
Do you understand how forms work, how CGI works?

If your SSI merely generates the data, then wrapping your SSI statement in <TEXTAREA> tags should do what you want.

Without more info on what systems (database?) you are working with though, it's difficult to help out with any of the other stuff.

--jim
 
Jim, yes new at all this. As for html and cgi I've been
toying with them lately.

I have perlscripts that I use at the command line which all work really good. I'm trying to talk with my amateur radio receiver and send it commands via web interface (cgi etc). I am at the point now where I can send the request via a SSI when the webpage loads and get the proper setting(s) back. I can also do this via a checkbox etc. However I need or would like to have this setting/return value from the initial page load go into an editable text box that would normally be generated using the <form>. Then I would like to be able to change the value that is in that text box and issue the change back to the receiver via another script, refreshing the html to show the new settings.

What I was thinking is that I should do it during the while(). I have this right now.

while($socket){
print "Content-type: text/html\n\n";
print;

This works by just printing the standard text/html. So I was thinking of having the textbox here and making the print push the output to that textbox. Then I'd need a way to allow for me to modify the output of the textbox and push the changes back in via a script that makes a connection and sends the command.

Hope thats a little better in explanation. If not please let me know so I can expand on it some more. I've been googling but havent come up with a similiar situation/solution.

TIA
infor
 
You should only need to have your SSI tag set to execute the Perl script. The Perl script will output your textarea, buttons and form tags for the update/submission of data.

Example HTML with SSI tag:
Code:
<html>
<body>
<p>blah blah blah</p>
<!--# exec cgi="/cgi-bin/perlscript.pl" -->
</body>
</html>

Example Perl Script output:
Code:
<form name="myform" action="/cgi-bin/perlscriptsubmit.pl" method="post">
<textarea><%%output from server query%%></textarea><br />
<input type="submit" >&nbsp;<input type="reset" />
</form>

Results of the two examples:
Code:
<html>
<body>
<p>blah blah blah</p>
<form name="myform" action="/cgi-bin/perlscriptsubmit.pl" method="post">
<textarea><%%output from server query%%></textarea><br />
<input type="submit" >&nbsp;<input type="reset" />
</form>
</body>
</html>

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top