A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Help this Actionscript newie here please!

  1. #1
    Join Date
    Apr 2004
    San Juan, Argentina

    Help this Actionscript newie here please!

    Hi all,
    I got a big problem and working on it for a weeks now and not can get it to work. The thing I want to do is make my flash form work so
    It open the PHP file in a new window and pass the data of the form to the PHP.
    My flash form is inside a movie clip called form_mc. Inside the form_mc is the submit_btn and the reset_btn and some input fields with instance names like first_name_txt, last_name_txt, address_txt and so on. My actionscript is located in the first frame of form_mc.

    This is what I come up with so far

    But its not working at all just the reset button.

    this.submit_btn.onrelease = function() {
    var my_lv:LoadVars = new LoadVars();
    my_lv.first_name = this.first_name.txt;
    my_lv.last_name = this.last_name.txt;
    my_lv.address = this.address.txt;
    my_lv.suburb = this.suburb.txt;
    my_lv.postcode = this.postcode.txt;
    my_lv.country = this.country.txt;
    my_lv.email = this.email.txt;
    my_lv.phone = this.phone.txt;
    my_lv.fax = this.fax.txt;
    my_lv.mobile = this.mobile.txt;
    my_lv.comments = this.comments.txt;
    //getURL("flash/form_validate.php", "POST");
    my_lv.sendAndLoad("flash/form_validate.php", "POST");
    this.reset_btn.onrelease = function() {
    first_name = "";
    last_name = "";
    address = "";
    suburb = "";
    postcode = "";
    country = "";
    email = "";
    phone = "";
    fax = "";
    mobile = "";
    comments = "";

    And this is how the PHP looks:
    PHP Code:
    <?php // validate form data
    // ideally you would want more stringent validation rules here!

    //if (!$_POST['first_name']) { echo "<p><strong>First name not entered! Please go back and try again</strong>\n"; die; }
    if (!$_POST['first_name']) { 
    "<p><strong>First name not entered!</strong></p>";
    "<a href='phoenix.html'>back</a>";

    //if (!$_POST['last_name']) { echo "<p><strong>Last name not entered! Please go back and try again</strong>\n"; die;  }
    if (!$_POST['last_name']) { 
    "<p><strong>Last name not entered!</strong></p>";
    "<a href='phoenix.html'>back</a>";
    //if (!$_POST['address']) { echo "<p><strong>address not entered! Please go back and try again</strong>"; die; }
    //if (!$_POST['suburb']) { echo "<p><strong>suburb not entered! Please go back and try again</strong>"; die; }
    //if (!$_POST['postcode']) { echo "<p><strong>postcode not entered! Please go back and try again</strong>"; die; }
    //if (!$_POST['country']) { echo "<p><strong>country not entered! Please go back and try again</strong>"; die; }
    //if ($_POST['passwd'] !==$_POST['passwd_c'] ) { echo "<p><strong>Password must be the same in both boxes! Please go back and try again</strong>."; die; }
    //if (!$_POST['email']) { echo "<p><strong>Email address not entered! Please go back and try again</strong>\n"; die;}
    if (!$_POST['email']) { 
    "<p><strong>Email address not entered! </strong></p>";
    "<a href='phoenix.html'>back</a>"; die;
    //regexp validation of email
    //added by martin on 8th of august 2003
    $regexp "/^\w(\.?[\w-])*@\w(\.?[-\w])*\.[a-z]{2,4}$/i";
        if (!
    preg_match($regexp$_POST['email'])) {
    "<p><strong><em>the email address doesn't seem to be valid, please go back and try again.</em></strong></p>";
    "<a href='phoenix.html'>back</a>";
    } else {

    // from [url]http://www.apptools.com/phptools/forms/forms4.php[/url]
    // In testing, if you get an Bad referer error comment out or remove the next three lines
       //   if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
         //    !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
         //    die("Bad referer");
    $msg="Values submitted by the user:\n";
    $_POST as $key => $val){
             if (
    $msg.="Item: $key\n";
    $val as $v)
    $msg.="   $v\n";
             } else
    //   $recipient="someemail1@somewhere.com";
    // $recipient="someemail3@somewhere.com";
         //  $recipient="someemail4@somewhere.com";
         // $recipient="someemail5@somewhere.com";
    $subject="Form submission";
    $redirect "phoenix.html";
          if (
    "<h1>Thank you</h1><p>Message successfully sent:</p>\n";
    "<a href='phoenix.html'>return to phoenix</a>";
          } else
    "<p>An error occurred and the message could not be sent.</p>";         
       } else
    "Bad request method";

    Please help.

    Greetings Jack
    Last edited by jhjsaat; 03-15-2005 at 01:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center