Just this afternoon, I tried how CGI works in Tinypy using my Microcore Linux. Unfornately, I did this manually 😦 I learned how CGI works internally without using a CGI module or any libraries. Since there’s no module related to CGI in Tinypy, the challenge is how will I get the values from the HTML form and parse it. Luckily, I’m using Linux 😀 I have nothing to say. Just observe and study the screenshots.
1. Entered the values for the 2 fields (name and age).
2. Extracted the QUERY_STRING line from CGI environment variables.
3. Removed the %20 from the string.
4. Removed the “QUERY_STRING=” substring, for me to easily do the parsing process.
5. Separated the 2 fields.
6. Yes! Successfully parsed the 2 fields 🙂
7. Here’s my code.
I haven’t tested some possibilities. Anyway, through this I can still improve and discover more things about CGI programming using Tinypy by making functions and modules (from scratch). Hope you learn something. ‘Til next time! 🙂
Note:
Just ignore the value for the age field and the click text of the button (I’m using Elinks browser and a CLI environment OS) as seen on the screenshots. Thanks!