Advertisement
Pihtija

Python v6

Apr 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. primer.py
  2. ----------------------------------------------------------------------
  3. #!/usr/bin/python
  4. # Import modules for CGI handling
  5. import cgi,cgitb
  6. #Traceback Create instance of FieldStorage
  7. cgitb.enable();form =cgi.FieldStorage()
  8. # Get data from fields
  9. first_name =form.getvalue('first_name')
  10. last_name =form.getvalue('last_name')
  11. print("Content-type:text/html\r\n\r\n")
  12. print("<html>")
  13. print("<head>")
  14. print("<title>Hello -Second CGI Program</title>")
  15. print("</head>")
  16. print("<body>")
  17. print("<h2>Hello %s %s</h2>"%(first_name,last_name))
  18. print("</body>")
  19. print("</html>")
  20. ----------------------------------------------------------------------
  21. //////////////////////////////////////////////////////////////////////
  22. pocetna.html
  23. ----------------------------------------------------------------------
  24. <html>
  25. <head>
  26. </head>
  27.  
  28. <body>
  29.  
  30. <form action="primer.py"method="get">
  31. First Name: <input type="text"name="first_name"><br/>
  32. Last Name: <input type="text"name="last_name"/>
  33. <input type="submit"value="Submit"/>
  34. </form>
  35.  
  36. </body>
  37. </html>
  38. ----------------------------------------------------------------------
  39. //////////////////////////////////////////////////////////////////////
  40. index.html
  41. ----------------------------------------------------------------------
  42. <html>
  43. <head>
  44. </head>
  45.  
  46. <body>
  47.  
  48. <form action="primer.py"method="get">
  49.  
  50. Ime: <input type="text"name="first_name"><br/>
  51. Prezime: <input type="text"name="last_name"/><br/>
  52. Adresa: <input type="text"name="adress"><br/>
  53. Telefon: <input type="text"name="phone_nm"><br/>
  54. e-mail: <input type="text"name="mail"><br/>
  55. vrsta pice: <select name="dropdown">
  56. <option value="Kapricoza" >Kapricoza</option>
  57. <option value="Fungi" >Fungi</option>
  58. <option value="Vezuvio" >Vezuvio</option>
  59. </select>
  60. velicina: <input type="radio" name="size" value="25"> 25 cm
  61. <input type="radio" name="size" value="30"> 30 cm
  62. <input type="radio" name="size" value="35"> 35 cm<br/>
  63. dodaci: <input type="checkbox" name="pavlaka" value="on"/> pavlaka
  64. <input type="checkbox" name="jaje" value="on"/> jaje
  65. <input type="checkbox" name="cili" value="on"/> cili
  66. <br/><br/>
  67.  
  68.  
  69. <input type="submit"value="Submit"/>
  70.  
  71. </form>
  72.  
  73. </body>
  74. </html>
  75. ----------------------------------------------------------------------
  76. //////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement