diff --git a/splash2/config.php b/splash2/config.php
index 01ea80f..aa478eb 100755
--- a/splash2/config.php
+++ b/splash2/config.php
@@ -1,9 +1,9 @@
getMessage();
-}
-?>
-
-
-
- Milk Table
-
-
-
-
-
-
-
-
-
+}
\ No newline at end of file
diff --git a/splash2/install.php b/splash2/install.php
index d3940ed..ba00904 100755
--- a/splash2/install.php
+++ b/splash2/install.php
@@ -8,10 +8,12 @@
PDO::ERRMODE_EXCEPTION);
echo 'Creating Tables...
';
+ $sqlite_db->exec("Drop table emails");
$sqlite_db->exec("CREATE TABLE IF NOT EXISTS emails (
id INTEGER PRIMARY KEY,
customer_email TEXT,
store_name TEXT,
- time INTEGER)");
+ time INTEGER,
+ UNIQUE(customer_email) ON CONFLICT REPLACE)");
echo 'Done...
';
diff --git a/splash2/js/scripts.js b/splash2/js/scripts.js
index 9fe9bc9..70a7ffa 100755
--- a/splash2/js/scripts.js
+++ b/splash2/js/scripts.js
@@ -29,11 +29,31 @@ $(document).ready(function(){
});
});
-// Thank you
+// Submit and Thank you
$("button").click(function() {
+ var jThis = $(this);
+ var attrName = jThis.attr('value').split('-')[0];
+
+ var email = $('input[name='+attrName+'-email]').val();
+ var store = $('input[name=store]').val();
- $("#thank-you").fadeIn(200);
+ if(store == null) store = '';
+
+ $.post('email.php',{"email":email,"store":store},
+ function(data) {
+ if(data == 'done')
+ {
+ alert($("#thank-you").html());
+ }
+ else
+ {
+ alert("We have encounter an error. Give us a minute");
+ }
+ });
+
});
+
+
}); /* End doc.ready */