Jump to content

ActionScript/PHP form please help


Lokee116

Recommended Posts

Hello, I've made a form in swishmax its part of an advertising splash page. on the submit button i have the following actionscript:

 

on (release) {
    if ((nameVar=="")||(emailVar=="")||(numberVar=="")||(msgVar=="")) {
        errormessage="Please fill all the fields";
    } else {
        errormessage="Sending....";
        send="yes";
        this.loadVariables("http://eznetpro.com/ad/flashq.php",'POST');
        nameVar="";
        emailVar="";
        numberVar="";
        msgVar="";
    }
}

 

I have a file named flashq.php in the specified location. the file looks like this:

 

<?
if ($send=="yes") {
$to = "flashad@eznetpro.com";

$re = "Question Submission";

$msg .= " Name: ";
$msg .=$_POST['nameVar'];
$msg .= ", Phone number: ";
$msg .=$_POST['numberVar'];
$msg .= ", E-Mail: ";
$msg .=$_POST['emailVar'];
$msg .= ", Question: ";
$msg .=$_POST['msgVar'];
$tfrom .=$_POST['emailVar'];

mail($to,$re,$msg,$tfrom);
}
echo "&errormessage=Email has been sent&";
?>

 

Im almost 100% positive that my hosting service supports .php

 

The flash page is being hosted at http://eznetpro.com/ad/eznet.html

 

The problem I'm having is the form isnt being sent.

when i launch the flash file from my pc and complete the form it has no problems talking to the php file hosted on the net, and sending the info. but when I upload the flash file and try to complete the form while its hosted online, its not talking to the php and not sending the info.. is there a problem with my code? i cant spot any and im not sure why it would work from my pc but not when hosted online.

 

Please help if you can, or let me know if you need any more info to troubleshoot.

Link to comment
Share on other sites

ok seems i do have php

 

PHP Version 4.3.10

 

System        Windows NT WIN2 5.2 build 3790 

Build Date        Dec 14 2004 17:46:48 

Server API        CGI/FastCGI 

Virtual Directory Support        enabled 

Configuration File (php.ini) Path        C:\WINDOWS\php.ini 

PHP API        20020918 

PHP Extension        20020429 

Zend Extension        20021010 

Debug Build        no 

Thread Safety        enabled 

Registered PHP Streams        php, http, ftp, compress.zlib 

 

Could there be any other reasons why its not working?

 

Link to comment
Share on other sites

Maybe you copied the file wrong. Try changing your first line to

<?php

inseat of

<?

 

hmm I tried that and still nothing..

 

I dont understand I cant find any errors in my code, ref links, or file locations... I have php enabled on the server. it seems to work when the flash file is on my local pc and the php is hosted on the web, but when they are both hosted on the web it doesnt work  ???

Link to comment
Share on other sites

  • 1 year later...

This example maybe a more easier approach for swish max just compare your code against this

 

As you know your submit button Action script code:

 

on (press) {
//checks if the fields are empty if so shows the error message
if (Name=="" or Email=="" or Message=="") {
info="Error Sending Message"

//checks if the name is more than 2 letters most names are more than 2 letters long
//if not shows the error message;
}
else if (Name.length < 2) {
info="Error Sending Message";
}
//checks if the Email is more than 3 letters most email addresses are more than 3 letters long
//if not shows the error message;
else if (Email.length < 3) {
info="Error Sending Message";
}
//checks that an @ has been entered into the Email Field
//if not shows the error message
else if (Email.indexOf("@") == -1) {
}
//checks that an . has been entered into the Email Field
//if not shows the error message
else if (Email.indexOf(".") == -1) {
}
//checks that the message is at least 10 letters long
//if not shows the error message
else if (Message.length < 10) {
info="Error Sending Message";
}
//if everything has passed the checks it loads the variables
//and sends the message
else{
info="Message Was Sent";
loadVariables("send.php",'POST');
}
}

 

Your external flat file named file:flashq.php can replace the send.php

 

The external file referenced in the submit button:

 

<?php
$EmailFrom = "your email address";
$EmailTo = "your email address";
$Subject = "Form submitted from site";
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Message = Trim(stripslashes($_POST['Message']));
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .="\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .="\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .="\n";
$success -mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
?>

 

Info box which provides the user error or sent message in response to submitting the form this action script is placed in the scene root and a info box created using the text tool and selecting: Input Text.

 

onLoad () {// carries the function out once
Name="";//clears the Name box
Email="";//clears the Email box
Message="";//clears the Message box
info="";//clears the info box
}

 

If you can get this script to work then all you do is add the extra fields as required.

 

For a button to reset the form the action script is as follows:

on (press) {// carries the function out when button is clicked
Name="";//clears the Name box
Email="";//clears the Email box
Message="";//clears the Message box
info="";//clears the info box
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.