www.fachtnaroe.ie



Web This site

Using Perl Online

[Programming Home] [Input (2)] [Process (3)] [Output (1)]

Input

What you should be finding is that the input -> process -> output method that you have been using at the command line is not available to you. We need to start looking at some basic input methods, using input forms.

Navigate to:

/home/your_username/public_html/

within our server and create the file addnumbers.html entering the following html code, putting your username in place as required :


<html>
<body>
<h2>Sample Sum</h2>
<form action="/cgi-bin/YOURUSERNAME/addnumbers.pl" method="post">
<br />Enter a number: <input type="text" size="10" name="first_num">
<br />Enter a number: <input type="text" size="10" name="secnd_num">
<br />Enter a number: <input type="text" size="10" name="third_num">
<br />
<input type="submit" value="Press to add the numbers!">
</form>
</body>
</html>

To open this page, use your browser to open the location:

http://xen.fachtnaroe.net/~your_username/addnumbers.html

and see what appears on screen. It should be a short, simple form allowing you to enter numbers and submit them for addition. If there are errors in the page, edit the html to confirm your code is correct.

It is not normal to place .html files in the cgi-bin folders. This is why we have put the html file in your private folder, but referenced the script in the cgi-bin folder. Equally, it is not normal to place executable scripts outside of the cgi-bin location.

In the background...

Once the submit button in the web form is pressed, the action specified in the <form > tag is carried out, namely the execution of the specified script. Now we need to make that script. Pressing the submit button until that exists will yield a 404 (File not found) error from the browser.

Next, processing the input...


[Programming Home] [Input (2)] [Process (3)] [Output (1)]

Last updated: 20120108-18:14
back to top
Fachtna Roe, Senior College, Central Technical Institute, Clonmel, Ireland.