<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<style>
body {font-family: Arial, Helvetica, sans-serif;}
form {border: 3px solid #f1f1f1;}

input[type=text], input[type=email], select {
  width: 49%;
  font-size:20px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

button {
  background-color: #4CAF50;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  cursor: pointer;
  width: 100%;
}

button:hover {
  opacity: 0.8;
}

.cancelbtn {
  width: auto;
  padding: 10px 18px;
  background-color: #f44336;
}

.imgcontainer {
  text-align: center;
  margin: 24px 0 12px 0;
}

img.avatar {
  width: 20%;
  border-radius: 50%;
}

.container {
  padding: 16px;
}

span.psw {
  float: right;
  padding-top: 16px;
}

/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
  span.psw {
     display: block;
     float: none;
  }
  .cancelbtn {
     width: 100%;
  }
}
</style>
</head>
<body style="background:#000;">

<center><h1 style="color:#fff">wanTED Tutorial: Post HTML Form Data to Google Spreadsheet in 2 Minutes</h1></center>

<form id="form" target="_self" onsubmit="return postToGoogle();" action="" autocomplete="off"> 
<input id="nameField" name="entry.2008660880" placeholder="Enter your name" type="text" required> 
<input id="emailField" name="entry.1460631936" placeholder="Enter your email" type="email" required> 
<input id="mobField" name="entry.904964149" placeholder="Enter your 10 Digit Phone Number" type="text" pattern="^\d{10}$" required>  
<select id="cinema" name="entry.1878256062" placeholder="Select Cinema" required>
<option value="">Why wanTED Talks Youtube Channel?</option>
<option value="City: Delhi, Cinema: PVR Logix City Centre IMAX, Noida">Time Saving Fast Track Tutorials</option>
<option value="City:Bengaluru  Cinema:Cinepolis IMAX Forum Shantiniketan">Provide Code for reference</option>
<option value="City:Chennai Cinema:SPI Palazo The Forum Vijaya Mall, Vadapalani">Instant Replies of Comments</option>
<option value="City:Pune Cinema:Cinepolis Westend Mall, Pune">Latest Code Updates</option> 
</select> 
<button id="send" type="submit" class="common_btn">Register Now</button>
</form>

<h3 id="success-msg" style="text-align: center !important; margin-top:190px !important; display:none; color:#fff"> Your Request has been posted to Google Spreadsheet</h3>



<img src="wan.jpg" style="width:100%; opacity:.4;">




<script>
function postToGoogle() {
                var field1 = $("#nameField").val();
                var field2 = $("#emailField").val();
                var field3 = $("#mobField").val();
                var field4 = $("#cinema option:selected").text();
     
    if(field1 == ""){
     alert('Please Fill Your Name');
     document.getElementById("nameField").focus();
     return false;
    }
    if(field2 == ""){
     alert('Please Fill Your Email');
     document.getElementById("emailField").focus();
     return false;
    }
    if(field3 == "" || field3.length > 10 || field3.length < 10){
     alert('Please Fill Your Mobile Number');
     document.getElementById("mobField").focus();
     return false;
    }


    
 
                $.ajax({
                    url: "https://docs.google.com/forms/d/e/1FAIpQLSfwwr_thxplsWYLLkeH1KiyId5KKvTDSfNnzPd3HTJm0Ee-lg/formResponse?",
     data: {"entry.2008660880": field1, "entry.1460631936": field2, "entry.904964149": field3, "entry.1878256062": field4},
                    type: "POST",
                    dataType: "xml",
                    success: function(d)
     {
     },
     error: function(x, y, z)
      {

       $('#success-msg').show();
       $('#form').hide();
       
      }
                });
    return false;
            }
</script>
</body>
</html>