Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 5th, 2018 131 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #! /usr/bin/env python3
  2. print("Content-type: text/html\n")
  3. import cgi
  4. import MySQLdb
  5. string = "i211f18_affoster"
  6. password = "my+sql=i211f18_affoster"
  7. db_con = MySQLdb.connect(host = "db.soic.indiana.edu", port = 3306, user = string, passwd = password, db = string)
  8. cursor = db_con.cursor()
  9.  
  10. printing = """<!doctype html>
  11. <html>
  12.     <head>
  13.         <title>Robot Delivery System</title>
  14.     </head>
  15.     <body>
  16.         <h1>What would you like to have delivered</h1>
  17.         <form action = "addDelivery.cgi" method = "post">"""
  18.        
  19.        
  20. try:
  21.     sql = "select items.itemName from items;"
  22.     cursor.execute(sql)
  23.     result = cursor.fetchall()
  24. except Exception as e:
  25.     print("something wrong")
  26. else:
  27.     for row in result:
  28.         printing += """<input type = "radio" name = "item" value = '""" +  row[0] + "'>" + row[0] + "<br>\n"
  29.    
  30. printing += """<h2>Cost: $</h2>
  31.             <br>
  32.             <input type = "text" name = "cost">
  33.             <br>
  34.             <h2>Delivery Method:</h2>
  35.             <br>
  36.             <input type = "radio" name = "method" value = "drone">Flying Drone ($10)
  37.             <br>
  38.             <input type = "radio" name = "method" value = "car">Self Driving Car ($20)
  39.             <br>
  40.             <input type = "radio" name = "method" value = "robot">Giant Robot ($1000)
  41.             <br>
  42.             <button type = "submit">Submit</button>
  43.         </form>
  44.     </body>
  45. </html>"""
  46. print(printing)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top