thnx
flash & phpflash conatct form
Page 1 of 1
7 Replies - 1398 Views - Last Post: 14 September 2010 - 05:28 PM
#1 Guest_Avicena*
flash & php
Posted 12 September 2010 - 10:10 AM
Ok guys, this is not big problem for you flash guru guys but I've stucked and little bit in rush . I created contact form in flash AC2 with PHP code. Everything works fine but when I click submit button to send message, I'm redirected on blank (contact.php) page. How can I avoid this (that blank page)????
thnx
thnx
Replies To: flash & php
#2 Guest_Avicena*
Re: flash & php
Posted 12 September 2010 - 10:12 AM
Ok guys, this is not big problem for you flash guru guys but I've stucked and little bit in rush . I created contact form in flash AC2 with PHP code. Everything works fine but when I click submit button to send message, I'm redirected on blank (contact.php) page. How can I avoid this (that blank page)????
thnx
thnx
#3
Re: flash & php
Posted 12 September 2010 - 03:55 PM
Firstly, its really time to move onto AS3. Secondly, you need to show come code if you want any help. Cant guess at what your trying.
#4 Guest_Avicena*
Re: flash & php
Posted 13 September 2010 - 05:01 AM
Yes you're right abt AC3, I work in it, that's why the problem is for me to handle this... This app I got almoust finished just I have to change and upgrade some things and when I figured out that is writen in AC2 I lost myself in attempting to connect PHP file with AC2 in a way that contact form doesn't redirect me on contact.php file. Ok here is the code:
This is AC and it's writen on send button:
This is PHP:
Edited by macosxnerd101: Please,
.
This is AC and it's writen on send button:
on(release){
if((name_input.text=="")||(email_input.text=="")) {
error.text = "Please fill all fields"
}
else {
var fromname=name_input.text;
var fromemail=email_input.text;
var frommessage=message_input.text;
getURL("contact.php", 0 , "POST");
error.text="Message sent"
name_input.text= "";
email_input.text= "";
message_input.text ="";
send_btn.enabled=false;
send_btn._alpha=20;
}
}
This is PHP:
<?php
$sendto = 'something@gmail.com';
$subject = 'Email from user';
$name = $_POST['fromname'];
$from = $_POST['fromemail'];
$message = $_POST['frommessage'];
$message = stripslashes($message);
$content = "Name: " . $name . "\n";
$content .= "Email: " . $from . "\n\n";
$content .= $message;
if(mail($sendto,$subject,$content))
{
echo 'response=passed ';
}
else
{
echo 'response=failed';
}
?>
Edited by macosxnerd101: Please,
#5
Re: flash & php
Posted 13 September 2010 - 05:49 PM
Problem is, you never send you variables to your php. So lets revise this a bit. For the AS2, try something like this
Keep your php the same for now. Havnt tested this, so you will need to let me know the result.
on(release){
if((name_input.text=="")||(email_input.text=="")) {
error.text = "Please fill all fields"
}
else {
my_lv = new LoadVars();
my_lv.fromname=name_input.text;
my_lv.fromemail=email_input.text;
my_lv.frommessage=message_input.text;
error.text="Message sent"
name_input.text= "";
email_input.text= "";
message_input.text ="";
my_lv.sendAndLoad('contact.php',my_lv,'POST');
send_btn.enabled=false;
send_btn._alpha=20;
}
}
Keep your php the same for now. Havnt tested this, so you will need to let me know the result.
#6 Guest_Avicena*
Re: flash & php
Posted 13 September 2010 - 06:29 PM
Unfortunately , something is still wrong. With this code, now the error button doesn't work to,and flash file has no connection with php file
(( Thanx for reply if you have just a little bit more patient with this I'll be gratefull
#7
Re: flash & php
Posted 14 September 2010 - 07:17 AM
Can you post the code again and the exact errors.
#8 Guest_Guest*
Re: flash & php
Posted 14 September 2010 - 05:28 PM
OK, everything is fine, all stuff work. Thank you a lot. I knew I have to call variables but didn't know how to do that in AC2. It's before my time:).
But for all others here is the AC code again:
But for all others here is the AC code again:
on(release){
if((name_input.text=="")||(email_input.text=="")) {
error.text = "Please fill all fields"
}
else {
my_lv = new LoadVars();
my_lv.fromname=name_input.text;
my_lv.fromemail=email_input.text;
my_lv.frommessage=message_input.text;
my_lv.sendAndLoad('contact.php',my_lv,'POST');
error.text="Message sent"
//This code is just for clearing all boxes
name_input.text= "";
email_input.text= "";
message_input.text ="";
send_btn.enabled=false;
send_btn._alpha=20;
}
}
This post has been edited by macosxnerd101: 14 September 2010 - 05:42 PM
Reason for edit:: Added code tags. Please use them in the future.
Page 1 of 1
|
|

New Topic/Question
Reply
MultiQuote







|