if you need it, my php info is at http://www.laurentobia.com/phpversion.phpQuote:
Originally Posted by Chimpanzee
Printable View
if you need it, my php info is at http://www.laurentobia.com/phpversion.phpQuote:
Originally Posted by Chimpanzee
Hi All,
Can someone please help me out :( been stuck on trying to solve this issue for a while now and cant figure out why it isnt working.
As the Point of this whole thread is about PHP not recieving variable from flash, i thought this would be the best place to put it!
The Variables are assigning correctly in flash but when passing them to PHP nothing is in the $_POST array :thumbsdow
Here is my flash code and PHP
[Flash Code]var msg:LoadVars = new LoadVars();
var TScore = "465";
var TName = "Testing"
msg.nName = nName.text;
msg.score = Score.text;
phpResult.text = msg.toString();
msg.send("WebsiteAddress.php","_parent","POST");[/Flash Code]
Can someone please point out where the bloody hell i am going wrong please, its doing my head in!PHP Code:<html>
<head>
<title>Basic PHP</title>
</head>
<body>
<?php
$link = mysql_connect("localhost", "blah", "blah");
if(!$link) {
// no database link, handle appropriately
} else { // we have db, lets continue!
$result = mysql_select_db("awm_eq264145", $link);
if(!$result) {
// no db selection, handle appropriately
} else { // we have our db, lets continue!
$query = "INSERT INTO assignment (Name, Score) VALUES ('" .$_POST['nName']."','". $_POST['score']."')";
if(mysql_query($query,$link)){
//if the query was successfully sent, get the number of rows
$rows_affected = mysql_affected_rows($link);
} else {
printf("<pre>");
print_r($_POST);
printf("</pre>");
printf($query);
printf("bollox didnt work");
}
}
}
?>
Hi,
flash should look like
var msg:LoadVars = new LoadVars();
msg.TScore = "465";
msg.send("WebsiteAddress.php","_parent","POST");
Musicman
Hi there,
I have an email form movie with a php script which works perfectly as a standalone swf.
The problem arise when I import the form into my website movie and make it a movie symbol, which I subsequently drag into another page and at this stage the form stops working. Must be something simple I have overlooked.
Any ideas? Help appreciated.
Jan
Hi,
this sounds very much like the old loadvariablesnum with level 0 or _root as a target.
Once your movie works with loadvariables and relative target (this, _parent) or a loadvars object, it should work by itself and as part of a bigger movie
Musicman
Thanks for the reply!
What I have is the following:
on (release) {
sender_mail = _root.Semail.text
sender_name = _root.Sname.text
sender_subject = _root.Ssubject.text
sender_message = _root.Smessage.text
loadVariables("sendmail.php",this,"POST");
this.onData = function()
{
for(var a in this) trace([a,this[a]])
_root.nextFrame();
if(this.output=='sent')
{
_root.errTitle = 'Thank You.';
_root.errType = "Your message has been succesfully sent.";
} else {
// else
_root.errTitle = "Error!";
_root.errType = "Attention, an error occurred while processing your message. Please try again later.";
}
}
}
Funny that it works on it's own though!
Is there such a thing in flash that you cannot place a movie symbol within another movie symbol for the php script to work? Simply asking because it seems odd for it work when in a standalone, but not when imported.
Thanks again!
Jan
Hi,
are you sure your text fields are still in the _root?
Musicman
You may well have a point there Musicman!
As I have trawled the net for a solution, I understand that there is a common problem attached to the use of _root and that _root infact is regarded as poor practice.
With regard to my example above, is there any way to re-write the code to avoid _root ?
Thanks again!
Jan
That did the trick! Simply replaced all _root with _parent and "hey presto"!
Thanks again Musicman!
Best Regards
Jan
had the same exact problem
not sure if this is the right post to get some help with this but my flash isnt communicating with my php file for sending email from flash
Code:var sendData_lv:LoadVars = new LoadVars();
var receiveData_lv:LoadVars = new LoadVars();
var formValidated:Boolean;
var errorMessages:Array = new Array();
receiveData_lv.onLoad = function():Void{
trace(this.sent);
if(this.sent == "OK"){
message0_txt.text = "Thank you for your Request, I will be intouch with you shortly";
}else{
message0_txt.text = this.sent;
}
}
submit_btn.onRelease = function() {
//this clears the error text field if they have been populate previously
clearTextFields();
errorMessages.length = 0; //empty the array so next time the submit button is clicked the array is not already populated
formValidated = checkForm();
if (formValidated) {
//the form is valid and so now we can send details to our PHP file
//populate LoadVars object with the field values
sendData_lv.name = name_txt.text;
sendData_lv.email = email_txt.text;
sendData_lv.phone = phone_txt.text;
sendData_lv.request = request_txt.text;
//trace(sendData_lv.email);
//trace("valid");
sendData_lv.sendAndLoad("email1.php"+new Date().getTime(), receiveData_lv);
} else {
//populate textfields with the error messages
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = errorMessages[i];
trace(errorMessages[i]);
}
}
};
function checkForm():Boolean {
//check whether the name field is empty
if (name_txt.text == "") {
errorMessages.push("Please enter your name.");
}
if (email_txt.text == "") {
errorMessages.push("Please enter your email address.");
} else if (email_txt.text.indexOf("@") == -1 || email_txt.text.indexOf(".") == -1) {
errorMessages.push("Please enter a valid email address.");
}
if (request_txt.text == "") {
errorMessages.push("Please enter Request information");
}
//if at this point the array is empty i.e has length 0, then this in effect means the form has passed all checks
if (errorMessages.length == 0) {
return true;
} else {
return false;
}
}
function clearTextFields():Void {
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = "";
;
}
}
PHP Code:<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$request = $_POST['request'];
$subject = 'Request from your website';
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
//ENTER YOUR EMAIL ADDRESS HERE
$to = '[email protected]';
//---------------------------
$success = mail($to, $subject, $request, $headers);
if($success){
echo '&sent=OK';
}else{
echo '&sent=Error';
}
?>
Hi,
I can occasionally help when I know an actual website url
Musicman
www.parkagencywest.comQuote:
Originally Posted by Musicman
Okay, I can't figure out why this isn't working. I'm trying to send an e-mail from my flash site, and it acts like it's going through, but I'm not getting any of my test e-mails.
Here is my AS:
And here is my PHP.PHP Code:stop();
send_btn.onRelease = function() {
my_vars = new LoadVars();
my_vars.sender = email_box.text;
my_vars.subject = subject_box.text;
my_vars.message = message_box.text;
if (my_vars.sender != "" and my_vars.subject != "" and my_vars.message != "") {
my_vars.sendAndLoad("email.php", my_vars, "POST");
gotoAndStop(25);
} else {
error_clip.gotoAndPlay(25);
}
my_vars.onLoad = function() {
gotoAndStop(26);
};
};
email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function () {
if (error_clip._currentframe != 1) {
error_clip.gotoAndPlay(6);
}
};
What am I doing wrong?PHP Code:<?php
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$sender = $_REQUEST["sender"];
$full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message;
$message= $full_message;
$message = stripslashes($message);
$subject = stripslashes($subject);
$sender = stripslashes($sender);
$subject = "Contact form ". $subject;
if(isset($message) and isset($subject) and isset($sender)){
mail("[email protected]", $subject, $message, "From: $sender");
}
?>
Hi,
can you just upload this php file and view it in browser?
If you do get the mail, then there might be a problem with your movie. If you dont get it, you should ask the server staff for assistanceCode:<?
mail("[email protected]", "test message", "just a test", "From: [email protected]");
echo "mail sent...";
?>
Musicman
Okay, I uploaded just the that php file, and it showed up in the directory, so when I clicked on it, nothing happened. No e-mail, or anything. I take it I need to talk to the server staff now?Quote:
Originally Posted by Musicman
Hi,
it did not even say "mail sent" then?
Could this be a windows server with unconfigured mail function?
Musicman
Here is all that shows up:
http://www.tomartin.net/php.php
Should I have renamed the php file "index" instead?
Hi,
probably write the file again, with as simple a program as possible (e.g. notepad on windows) that does not add
<title>Untitled Document</title>
by itself or convert every < to <
Musicman
Such as this?
http://www.tomartin.net/mail.htm
Sorry, I'm relatively new to PHP
Hi,
having a closer look, I see
It seems you are on a macintosh. Dont you have simpletext or something else that allows you to write a text of, say 100 characters and results in a file no larger than 100 bytes?Code:<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name=Title content="<">
<meta name=Keywords content="">
<meta http-equiv=Content-Type content="text/html; charset=macintosh">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="mail_files/filelist.xml">
Musicman
Yea I do, should I try that and see if that simplifies things at all?Quote:
Originally Posted by Musicman
Alright, here is the updated file:
http://www.tomartin.net/Email.html
Hi,
this is your text file now
This is what it should read (and how it looks in the browser)Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
</style>
</head>
<body>
<p class="p1"><?</p>
<p class="p1">mail("[email protected]", "test message", "just a test", "From: [email protected]");</p>
<p class="p1">echo "mail sent...";</p>
<p class="p1">?><span class="Apple-converted-space">Â </span></p>
</body>
</html>
Maybe you should try to write a "text" rather than "html" file in the first place, to keep software from doing things that hinder rather than helpCode:<?
mail("[email protected]", "test message", "just a test", "From: [email protected]");
echo "mail sent...";
?>
Musicman
Are you saying I need to make it as a rtf or .txt file and upload it? Cuz if I do that, it just downloads when I click on it. As evidenced here:Quote:
Originally Posted by Musicman
http://tomartin.net/mail.rtf
Hi,
make it a txt (rtf also adds stuff to the file that you would not want, just different stuff), upload it, and rename it to php on the server
Musicman
I don't think I quite understand. I did what you said (Changed the rtf format to a txt format, then uploaded the txt file, and changed the extension to a php file).Quote:
Originally Posted by Musicman
http://www.tomartin.net/mail.php
That is what shows up though. What did I do wrong? Haha, this is more complicated than I was thinking it would be
Edit, nevermind, that works now when I click on that. So should I just try retyping all the original PHP script into a txt document and then try sending an e-mail from my contact form? Or is there another step I need to take?Quote:
Originally Posted by momtartin
Hi,
strange... it complains about stuff in lines 7 through 9 although the entire file should be exactly 4 lines long
I still believe the best program to write php text is one that does not even know about documents, html, rtf or anything like that - just plain text
Musicman
I wrote that in Text Edit on my mac. What program do you recommend? And what should I do now? I mean it works if I click on it, and it sends me an e-mail, but when I tried to upload my Flash file and change that txt file to a PHP file, no message was sent.Quote:
Originally Posted by Musicman
Hi,
that mail.php on your server still seems to contain rtf. I am not used with a mac at all, but I recall a friend mentioning simpletext. I will ask her
Where did you put your flash form (the swf, not the fla)?
Musicman
Simpletext was replaced with Text Edit on macs. Though I'm wondering, should I have placed my php file in the same folder as my swf file? The way I have it set up is as follows (this is the local file setup, I'll show the remote site later, I have to go to work now):Quote:
Originally Posted by Musicman
http://img401.imageshack.us/img401/2571/picture2uy3.png
Should I put that mail.txt in the same folder as my SWF?
Hi,
it is usually good practice to put the swf and the php into the same folder and just refer to it by "mail.php" (not http://www.yourserver.com/mail.php - this causes problems when people visit yourserver.com instead of www.yourserver.com)
In your particular case you might have
<embed src="folder/movie.swf" ....>
in your index.html file. In that situation the plain "mail.php" in your movie refers to the folder with the index file, not the one with the swf
Musicman
So I ended up just calling the customer service line, and apparently they had my domain on a server which didn't like PHP, and only used SMPT. So once they switched it over, I got it working, so we're all good. Thanks for your assistance though, I appreciate it.Quote:
Originally Posted by Musicman
Sorry if this has already been covered but theres alot of posts to go through.
ok so actionscript 2 flash CS3
Returns - Error opening URL 'http://ultimate-signatures.com/form.php'Code:var senderLoad:LoadVars = new LoadVars();
var recieveLoad:LoadVars = new LoadVars();
Sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theGladiatusName = theGladiatusName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.theSubject = theSubject.text;
senderLoad.theMessage = theMessage.text;
senderLoad.sendAndLoad("http://ultimate-signatures.com/form.php", recieveLoad);
}
recieveLoad.onLoad = function(){
if(this.sentOK) {
_root.gotoAndStop(300);
}
else{
_root.gotoAndStop(305);
}
}
the url is correct i have also tried putting within a subfolder and targeting that too.
PHP
Please can somebody help me ;:confused:Code:<?PHP
$to = "[email protected]";
$subject = "The Legion Contact Forum";
$message = "Name: " . $theName;
$message .= "\nGladiatusName: " . $theGladiatusName;
$message .= "\nEmail: " . $theEmail;
$message .= "\n\nSubject: " . $theSubject;
$message .= "\nMessage: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail";
sentOK = mail($to,$subject,$message,$headers);
echo "sentOK=" . $sentOK;
?>
Thanks in advance.
Andy
HI, If i send to flash vars this way, i have no problem seeing them in a dynamic text box :
But actually i get the $myTotal value from a POST:PHP Code:$myTotal=45;
echo "&myTotal=$myTotal&";
PHP Code:
And this way i get no value in my dynamic text boxPHP Code:$myTotal=$_POST['total'];
echo "&myTotal=$myTotal&";
Any ideas?
I´ve already search the forum ,with no clues.
Shouldn't you be getting your variable from $_REQUEST['total']?Quote:
Originally Posted by BADGROOVY
Did you check the php file on it's own to see if it output $myTotal as the value in the name/value pair string?
Yes, i use $_REQUEST.Quote:
Originally Posted by villain2
Yes, its echo´s fine.Quote:
Originally Posted by villain2
But it doesnt appear in Flash.
But actually Musicman gave me a nice tip that works , i already have the values in my php, and with flash i was trying to call them again to the server, so instead of that i use FLASH VARS.
THKS ANYWAY.
Hey Guys and Girls,
Im new to all this forum discussion thing so go easy on me please :P
anywhos, im currently studying IT and our brief wants us to design and create a website, me being good with site design i found it easy, until my online php application failed to work, keep getting an blank screen when i load it up:
(Asterix's are hiding my email from spambots just so you know)
<?php
function clean($data) {
$data = trim(stripslashes(strip_tags($data)));
return $data;
}
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload)/i";
foreach ($_POST as $key => $val) {
$c[$key] = clean($val);
if (preg_match($exploits, $val)) {
exit("<p>No exploits, please!</p>");
}
}
$show_form = true;
$error_msg = NULL;
if (isset($c['submit'])) {
if (empty($c['name']) || empty($c['email']) || empty($c['comments'])) {
$error_msg .= "Name, e-mail and comments are required fields. \n";
} elseif (strlen($c['name']) > 50) {
$error_msg .= "The name field is limited at 15 characters. Your first name will do! \n";
} elseif (!ereg("^[A-Za-z' -]", $c['name'])) {
$error_msg .= "The name field must not contain special characters. \n";
} elseif (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",strtolower($c['email']))) {
$error_msg .= "That is not a valid e-mail address. \n";
}
if ($error_msg == NULL) {
$show_form = false;
if (!empty($c['Other Contact']) && !ereg("^(http|https)", $c['Other Contact'])) {
$c['url'] = "Other Contact:" . $c['Other Contact'];
}
$subject = "Online Application";
$message = "Online Application Form:";
foreach ($c as $key => $val) {
$message .= ucwords($key) . ": $val \n";
}
$message .= "IP: {$_SERVER['REMOTE_ADDR']} \n";
$message .= "Browser: {$_SERVER['HTTP_USER_AGENT']}";
if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
$headers = "From: chris@5*******";
$headers .= "Reply-To: {$c['email']}";
} else {
$headers = "From: Online Application Form <chris@************> \n";
$headers .= "Reply-To: {$c['email']}";
}
$recipient = "chris@***********";
if (mail($recipient,$subject,$message,$headers)) {
echo "<p>Your mail was successfully sent.</p>";
} else {
echo "<p>Your mail could not be sent this time.</p>";
}
}
}
if (!isset($c['submit']) || $show_form == true) {
function get_data($var) {
global $c;
if (isset($c[$var])) {
echo $c[$var];
}
}
if ($error_msg != NULL) {
echo "<p><strong style='color: red;'>ERROR:</strong><br />";
echo nl2br($error_msg) . "</p>";
}
?> <p>Online Application TEST FOR CHRIS'S IT WORK!</p>
<p>*Indicates Mandatory Field</p>
<form action="" method="post">
<p>FULL Name
<label>
<input type="text" name="name" id="name" value="<?php get_data("name"); ?>" />
</label>
</p>
<p>Email Address
<label><input type="text" name="email" id="email" value="<?php get_data("email"); ?> donthaveemail@dont_have_email.com" />
</label>
</p>
<p>Telephone Number
<label>
<input type="text" name="telephoneNumber" id="Other Contact" value="<?php get_data("telephoneNumber"); ?>" />
</label>
</p>
<p>Where did you hear about the election?
<label><input type="text" name="reasonForapplication" id="subject" value="<?php get_data("reasonForapplication"); ?>" />
</label>
</p>
<p>Referance No.1
<textarea name="References" id="references"><?php get_data("references"):?>
</textarea>
</p>
<p>Why You Think You Should Be Elected:
<label>
<textarea name="Manifesto" cols="70" rows="20" id="manifesto"><?php get_data("manifesto"); ?>
</textarea>
</label>
<br />
<input type="submit" name="submit" id="submit" value="Send" />
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form> <p>
<?php
}
?>
Hi, I'm old but back after a long time.Quote:
Originally Posted by 55chris2303
I'm not going to be hard on you, but also I'm not going to find where your poroblem is. But try:
at the very first line of your script.PHP Code:error_reporting(E_ALL);
it should prevent
Or -if your HTTP-server is Apache- you can also put this debug switch in a .htaccess fileQuote:
Originally Posted by 55chris2303
just some other tips:Code:# php_value display_errors Off
php_value display_errors On
PHP Code:<?php
$recipient = "chris@asteriskguru*com";
// and
if (mail($recipient,$subject,$message,$headers)) { }
// In case you use variables only once...
// then I would put those field as hard as possible, so:
if (mail("[email protected]", $subject, $message, $headers)) { }
// but also counts for $subject and especially $headers
?>
// Lack of an defined action parameter will usually default on the script itself.
<form action="" method="post">
// But with "" as value, I would not rely on that. so maybe:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">