Passing fields

Try online Examples

Here is how field data is retrieved in an Aptilis programme.

Here's what the HTML looks like:

	<FORM action="/cgi-bin/aptilis.exe" method="POST">
	<INPUT type="hidden" name="file" value="/home/scripts/simple.e.txt">

	Say Hello (or something)!:<BR>
	<INPUT type="text" name="usersaid" size=20>
	<INPUT type="submit" value="Send">
	</FORM>

And now, the Aptilis programme saved as simple.e.txt

sub main


	print("Content-type: text/html\n\n")


	print("<HTML>\n<BODY>\n\n")
	print("<B>you said:</B> ")

	print(usersaid$)

	print("</BODY>\n</HTML>")


end main

Things learnt

Note:
From version 1.043, aptilis can also retrieve files as sent through the <INPUT type="file" name="varname"> tag. In order to do that, the <FORM> tag of your form must also contain the encoding type used in the following fashion:
ENCTYPE="multipart/form-data"
The method has to be 'POST'.