Step 2: Write HTML code that create a form field on the screen.
In this step, we use html without perl to create an input field and form. It will let you type into the form, but wont do anything interesting with the information you type into the form, but will just go to another form.
Please read: Create a form field tutorial page: http://www.w3schools.com/html/html_forms.asp
Your job: There is no perl in this step. Just create 2 html files. When you browse to the first file, it will ask you for a search word using an html form. You can then type a word and press submit using an html post action. It will then display "got to the new file".
Instructions on creating these html files:
Create one html file to be used as a target action that just has <HTML><BODY> got to the new file</BODY></HTML> named target.html
Create the second html file that will hold your form field. Set it up with html and body start and end tags.
Create a form with a text box using the tutorial. Your text box should ask for a search word, not a name, and the name of the field should be "input". Here is the tutorial's example:
<form>
First name:<br>
<input type="text" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>Change the form tag to add a target of your target.html file and a submit button to the form. Make your button say OK instead of submit. The tutorial's example is :
<form action="action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>Experiment with making this a get method: put method="GET" between the words form and action. Run this in the browser and see the url now has ?
<form method="GET" action="action_page.php">
Change this to a POST method and see that the url now no longer has ?. It is still sending a session variable into the query string, but it does not display in the url.
<form method="POST" action="action_page.php">
You now know how to create a form with an input field that takes some action upon submitting. You have not yet retrieved the input but you have passed it along to another program.