Reputation: 329
I don't know much about web programming and I would really appreciate the help on this.
I have an HTML page that has an input field:
<input type="text" size=20 />
I want to run a CGI script that will return a value so that I can put it in the input field as a default when the page first loads.
So it would look like this I guess:
<input type="text" size=20 value=Run CGI script />
The script is a shell script that I named hostname.cgi and it contains the following:
#!/bin/sh
printf "Content-type: text/html\n\n"
printf $REMOTE_ADDR
When I try using
value=<!--include virtual="hostname.cgi" -->
I get an error on the HTML page that says an error occurred while running this directive (or something like that).
What am I doing wrong? Also, the script is in the same directory as the html file. Other CGI scripts on the page work just fine.
Upvotes: 1
Views: 647
Reputation: 201896
To put some default value somewhere as generated by a CGI script, you need to make the entire page generated by a CGI script. This means that the address of the page would be a reference to such a script. The details depend on the programming language used for the CGI script.
Upvotes: 1
Reputation: 3877
Not sure what you're trying to do here, I would really have to see the whole code. However, I suspect it's somethign to do with your format and the action defined:
<form action="/some_script_name" method="post">
<input type="text" name="ab" value="">
<input type="submit" value="Submit">
</form>
You also need to surround attributes with quotes:
<input type="text" size="20" value="Run CGI script" />
Upvotes: 1