hungree
October 29th, 2009, 09:36 AM
Good morning ladies and gents.
I'm attempting to load the contents for a flash form into a mySQL database I've setup. I'm pretty good with flash, a bit of a mySQL and php newbie but I'm sorting things out quickly. I've got the database, table and feilds setup approriately (i think) and thought the code in my PHP file was good. But no dice. The form contents reach me by email but they don't update in the database table.
See the code below, part of it was from a flash form, then I modified with some code I found in a forum:
<?php
/*----------------------------------------------------------
Author : www.mkeefedesign.com | Matthew Keefe
Contact : matt@mkeefedesign.com
$Id: send_email.php ,v 1.0 Tue Apr 26, 2005 02:20 PM
------------------------------------------------------------
* CODING & DESIGN ©2004 mkeefeDESIGN | ALL RIGHTS RESERVED
------------------------------------------------------------*/
$recipients = "sturbaindesigns@gmail.com" . ",";
$subject = "Skin Survey";
// Grab the key from Flash to ensure security
$sendKey = $_POST['key'];
// Only allow the page to send if Flash is the requester
if($sendKey == "email") {
// The following three variables are gathered from Flash
$name = $_POST['name'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$street = $_POST['street'];
$province = $_POST['province'];
$postal = $_POST['postal'];
$city = $_POST['city'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$phone = $_POST['phone'];
// Grab todays date
$date = date("F j, Y", time());
// This block is the actual message that is sent in the email
$email_info .= "Below is the visitors contact info and message.\n\n";
$email_info .= "Visitor's Info:\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "First Name: " . $name . "\n";
$email_info .= "Last Name: " . $lname . "\n";
$email_info .= "Email: " . $email . "\n";
$email_info .= "Street: " . $street . "\n";
$email_info .= "Province: " . $province . "\n";
$email_info .= "Postal Code: " . $postal . "\n";
$email_info .= "City: " . $city . "\n";
$email_info .= "Gender: " . $gender . "\n";
$email_info .= "DOB: " . $dob . "\n";
$email_info .= "Phone: " . $phone . "\n";
$email_info .= "Date Sent: " . $date . "\n\n";
$email_info .= "-----------------------------------------\n";
$mailheaders = "From: <sturbaindesigns@gmail.com> \n";
$mailheaders .= "Reply-To: " . $email . "\n\n";
if(mail($recipients, $subject, $email_info, $mailheaders)) {
print "&success=true";
mysql_connect("server", "username", "password");
mysql_select_db("database");
mysql_query("INSERT INTO table_name (`name`,`lname`,`email`,`street`,`province`,`posta l`,`city`,`gender`,`dob`,`phone`,) VALUES ('$name','$lname','$email','$street','$province',' $postal','$city','$gender','$dob','$phone',)");
}
}
?>
Any ideas what I'm doing wrong?
I'm attempting to load the contents for a flash form into a mySQL database I've setup. I'm pretty good with flash, a bit of a mySQL and php newbie but I'm sorting things out quickly. I've got the database, table and feilds setup approriately (i think) and thought the code in my PHP file was good. But no dice. The form contents reach me by email but they don't update in the database table.
See the code below, part of it was from a flash form, then I modified with some code I found in a forum:
<?php
/*----------------------------------------------------------
Author : www.mkeefedesign.com | Matthew Keefe
Contact : matt@mkeefedesign.com
$Id: send_email.php ,v 1.0 Tue Apr 26, 2005 02:20 PM
------------------------------------------------------------
* CODING & DESIGN ©2004 mkeefeDESIGN | ALL RIGHTS RESERVED
------------------------------------------------------------*/
$recipients = "sturbaindesigns@gmail.com" . ",";
$subject = "Skin Survey";
// Grab the key from Flash to ensure security
$sendKey = $_POST['key'];
// Only allow the page to send if Flash is the requester
if($sendKey == "email") {
// The following three variables are gathered from Flash
$name = $_POST['name'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$street = $_POST['street'];
$province = $_POST['province'];
$postal = $_POST['postal'];
$city = $_POST['city'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$phone = $_POST['phone'];
// Grab todays date
$date = date("F j, Y", time());
// This block is the actual message that is sent in the email
$email_info .= "Below is the visitors contact info and message.\n\n";
$email_info .= "Visitor's Info:\n";
$email_info .= "-----------------------------------------\n";
$email_info .= "First Name: " . $name . "\n";
$email_info .= "Last Name: " . $lname . "\n";
$email_info .= "Email: " . $email . "\n";
$email_info .= "Street: " . $street . "\n";
$email_info .= "Province: " . $province . "\n";
$email_info .= "Postal Code: " . $postal . "\n";
$email_info .= "City: " . $city . "\n";
$email_info .= "Gender: " . $gender . "\n";
$email_info .= "DOB: " . $dob . "\n";
$email_info .= "Phone: " . $phone . "\n";
$email_info .= "Date Sent: " . $date . "\n\n";
$email_info .= "-----------------------------------------\n";
$mailheaders = "From: <sturbaindesigns@gmail.com> \n";
$mailheaders .= "Reply-To: " . $email . "\n\n";
if(mail($recipients, $subject, $email_info, $mailheaders)) {
print "&success=true";
mysql_connect("server", "username", "password");
mysql_select_db("database");
mysql_query("INSERT INTO table_name (`name`,`lname`,`email`,`street`,`province`,`posta l`,`city`,`gender`,`dob`,`phone`,) VALUES ('$name','$lname','$email','$street','$province',' $postal','$city','$gender','$dob','$phone',)");
}
}
?>
Any ideas what I'm doing wrong?