Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
talkToDB = function (email, messageBox) {
// set up LoadVars Object
lv = new LoadVars();
// this function is triggered when the data is sent back from DB
lv.onLoad = function() { displayReturned(this.email, this.messageBox);
};
// format datastring and send to database
lv.email = email;
lv.messageBox = messageBox;
lv.sendAndLoad(DBPATH, lv, 'POST');
};
displayReturned = function (email, messageBox) {
// show data returned from PHP script
returnedEmail.text = email;
returnedMessage.text = messageBox;
};
//path to php script & database
_global.DBPATH = 'http://www.wangbar.co.uk/php/get_tektips.php';
//button event
sendButton.onRelease = function() {
talkToDB(yourEmail.text, yourMessage.text);
};
//
stop();
<?
#connect to database (separate script)
include 'connect.php';
#retrieve variables from Flash
$email=$_POST[email];
$messagebox=$_POST[messagebox];
#insert values into the database
$query="INSERT INTO tektips (email,message,date) VALUES ('".$email."','".$messagebox."',NOW())";
#check that the procedure ran properly otherwise throw error
$result=mysql_query($query) or die("mysql error while trying to run <b>$query</b>:".mysql_error());
#format and return variables to Flash
$returnedData="&email=$email&messagebox=$messagebox&";
echo $returnedData;
?>