Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is the code I have on the submit button of my flash 'contact' form. It points at a PHP script that is supposed to put the contact info into a mysql database. However something isn't working and I trying to isolate the problem.
Can anybody see anything obviously wrong with it?
Going a bit crazy with this...
Thanks a lot
markCode: Select all
on (release) {
if (checkboxname.selected == true) {
info = "yes";
} else {
info = "no";
}
if ((!Email.length || Email.indexOf("@") == -1) || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
} else if (!FirstName.length) {
EmailStatus = "Please enter your name before sending";
} else if (!ToComments.length) {
EmailStatus = "Please enter some text in your message";
} else {
loadVariablesNum("MailPHP10.php", 0);
EmailStatus = "Sending... ";
}
}Code: Select all
<?php
$dbhost = "127.0.0.1"; // Your database host here user..user.mysql.somehost.net
$dbusername = "******"; // Your database username here
$dbpw = "********"; // Your database password here
$dbname = "markwaterfield_com_-_contact"; // Database name here
$postvars = array("FirstName", "Email", "ToComments","HearAbout","info");
foreach ($postvars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
$connection = mysql_connect($dbhost, $dbusername, $dbpw) or die(mysql_error());
mysql_select_db($dbname, $connection);
$query = "INSERT INTO `sarah1` VALUES ('$FirstName', '$Email', '$ToComments', '$HearAbout','$info');";
mysql_query($query, $connection) or die(mysql_error());
mysql_close($connection);
Print "_root.Mail.EmailStatus=Complete - Your contact info has been sent";
?>feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]