PDA

View Full Version : Flash PHP mySQL - Submit form data to database


Digitalosophy
12-17-2004, 12:42 AM
I'll start it off :)

Learn how to set up a mySQL database, a Flash form, and a PHP page which will submit the Flash data into your database.

http://digitalosophy.com/experiments/archive/flash/dbInterv2.zip

msblack7of940
09-20-2005, 08:19 PM
hi, does anyone else have this file cause it's no longer available at the link.
thanks
7:)

msblack7of940
09-20-2005, 08:39 PM
hi everyone, i did some searching and i found an interesting article that looks like it can do what i need. i'll check it out and post back but here's the link:


www.4alltemplates.com/article_info.php/articles_id/49 (http://www.4alltemplates.com/article_info.php/articles_id/49)

7:)

Templarian
09-20-2005, 11:07 PM
Here this could help u out. its a fully functioning login system.

www.templarian.com/kirupa/log.zip (http://www.templarian.com/kirupa/log.zip)

//edit, although it doesnt have all the fancy checking stuff so its easier to understand.

miss7of9
09-22-2005, 04:08 PM
gosh i forgot to say that i am using flash mx not 2004 and i can't open the flash file.

also, what i'm really looking for is a script that will send an email and send the results to a mysql database. i found the email form script here at kirupa and it works perfectly but now i want to send the results to a database.

can someone help me out with a script or tutorial?

thanks
7:)

Here this could help u out. its a fully functioning login system.

www.templarian.com/kirupa/log.zip (http://www.templarian.com/kirupa/log.zip)

//edit, although it doesnt have all the fancy checking stuff so its easier to understand.

Templarian
09-22-2005, 04:41 PM
easy enough.

//edit, and i will explain it just use this portion chang ethe variables name and use

if($email=="undefined" || $subject=="undefined" || $message=="undefined"){
echo "Please fill in all the fields";
}else{
echo "Thankyou for registering.";
mysql_connect("localhost", "tablename", "password");
mysql_select_db("databasename");
mysql_query("INSERT INTO tablename (`email`,`subject`,`message`) VALUES ('$email','$subject','$message')");
here is the full script:
<?php
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

if($email=="undefined" || $subject=="undefined" || $message=="undefined"){
echo "Please fill in all the fields";
}else{
echo "Thankyou for registering.";
mysql_connect("localhost", "tablename", "password");
mysql_select_db("databasename");
mysql_query("INSERT INTO tablename (`email`,`subject`,`message`) VALUES ('$email','$subject','$message')");
}
?>

miss7of9
09-23-2005, 12:45 PM
thanks Templarian i'll try it out and post back! ;)

miss7of9
09-23-2005, 03:54 PM
oooooooooh you are wonderful Templarian!!!!! I got it. lol. what i did was add the above script to the email script i already had (had to figure that part out). yall let me know if you want me to post the entire script that allows you to do both.

thanks again,
7 :beam:

lbeetles
09-23-2005, 09:52 PM
Please post the whole scrip as ive been looking for something like this for my site.

Templarian
09-24-2005, 12:08 AM
happy i could help. although the Omega gave me the script a little while back when i was learning this stuff.

msblack7of940
09-26-2005, 11:14 PM
<?php
/************************************************** *\
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
* http://www.php.net/manual/en/function.mail.php
\************************************************* **/


// First, set up some variables to serve you in
// getting an email. This includes the email this is
// sent to (yours) and what the subject of this email
// should be. It's a good idea to choose your own
// subject instead of allowing the user to. This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "email@company.com";
$subject = "Contact Form";

// variables are sent to this PHP page through
// the POST method. $_POST is a global associative array
// of variables passed through this method. From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable. First, include From:
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own. The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["email"];

// now we can add the content of the message to a body variable
$message = $_POST["message"] . "\r\n";
$message .= "email: " . $_POST['email'] . "\r\n";
$message .= "subject: " . $_POST['subject'] . "\r\n";

// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

if($email=="undefined" || $subject=="undefined" || $message=="undefined"){
echo "Please fill in all the fields";
}else{
echo "Thankyou for registering.";
mysql_connect("localhost", "username", "password");
mysql_select_db("databasename");
mysql_query("INSERT INTO tablename (`email`,`subject`,`message`) VALUES ('$email','$subject','$message')");
}

?>

msblack7of940
09-26-2005, 11:33 PM
hi Templarian,
is the part before the database info suppose to be form validation? if so then i just realized that it didn't work for me. i was able to only fill in one field and it went through without any errors. is there a way to do the validation directly in Flash and if so where does it go with this script for the send button?

on (release) {
// send variables in form movieclip (the textfields)
// to email PHP page which will send the mail
form.loadVariables("email.php", "POST");
}

thanks and i hope you can help with this also.
7:)

Templarian
09-27-2005, 04:35 PM
Becuase It just checks if the user is trying to hit the send button by accedent. (the code uses || (or) when u could just use &&(and).

msblack7of940
09-27-2005, 09:56 PM
sorry Templarian, i have no idea what you are talking about. lol. can you help me out with a code for validation?
thanks again
7:)

Becuase It just checks if the user is trying to hit the send button by accedent. (the code uses || (or) when u could just use &&(and).

Templarian
09-27-2005, 11:10 PM
there is only a few 1 spot in your entire code that uses "or" ||, you just have to make it say "and" &&.

if(this1 == "" && this2== "" && this3 == ""){
all values are empty.
}
goodnight.

danielelvito
11-25-2007, 07:27 AM
where is fla and php .. source ?

mikedkap
08-15-2008, 12:07 PM
Does anyone have a finished version of this I could check out? :party:

-Kap