hasan1
December 29th, 2009, 01:03 AM
I want to make a web page that has a text box with a send button.
How should the html line be edited to send the text to the script as a variable 'a' and then store it in a variable in the script located at /usr/lib/cgi-bin?
HTML
<textarea name="comments" cols="50" rows="6">
Enter text here...
</textarea><br>
<input type="submit" value="send" >
<form action="/usr/lib/cgi-bin/s1.sh" method="post">
</form>
To execute s2 what changes should be made to the following code/tag.
s2 will print the first line to the screen.
action="/usr/lib/cgi-bin/s2.sh" method="post"
Scripts:
s1). After entering text and clicking the send button the web page should send the text lines as a variable i.e 'a' to a script s1 which would store the text to a file.
#!/bin/sh
a //for this I think a has to be declared in html tag.
$a>/home/../f1
s2) The script s2 will take the first line from the file f1 , display it on screen.
a=`head -n 1 f1`
echo $a
How should the html line be edited to send the text to the script as a variable 'a' and then store it in a variable in the script located at /usr/lib/cgi-bin?
HTML
<textarea name="comments" cols="50" rows="6">
Enter text here...
</textarea><br>
<input type="submit" value="send" >
<form action="/usr/lib/cgi-bin/s1.sh" method="post">
</form>
To execute s2 what changes should be made to the following code/tag.
s2 will print the first line to the screen.
action="/usr/lib/cgi-bin/s2.sh" method="post"
Scripts:
s1). After entering text and clicking the send button the web page should send the text lines as a variable i.e 'a' to a script s1 which would store the text to a file.
#!/bin/sh
a //for this I think a has to be declared in html tag.
$a>/home/../f1
s2) The script s2 will take the first line from the file f1 , display it on screen.
a=`head -n 1 f1`
echo $a