Contact Form (php) - how to prevent new window

Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default Contact Form (php) - how to prevent new window

    My contact form works just fine, however, I currently have the target set to
    "_blank" which is not what I want.

    Rather than opening the .php file open in a new window, I just want to go to a
    new frame (labeled "success" or "error") within my flash file (which currently
    works fine)

    So, my question is how do I send the form information to my php file WITHOUT
    having to open a new window outside of my flash file since I'm sending the user
    to new frame instead.

    FYI: I've already tried removing "_blank" but it still opens the php file in a
    new browser window.

    My code below:

    on (release){
    var my_lv:LoadVars = new LoadVars();

    my_lv.fullName = fullName_txt.text;
    my_lv.email = email_txt.text;
    my_lv.emailMessage = emailMessage_txt.text;

    if(fullName_txt.text != "" && email_txt.text != "" && emailMessage_txt.text
    != "") {
    my_lv.send("contact.php","_blank","POST");
    gotoAndStop("success");
    }
    else {
    gotoAndStop("error");
    }
    }

    Any help is greatly appreciated.

    Yvonne


    yself Guest

  2. Similar Questions and Discussions

    1. contact form
      Can anyone help me. I have a contact form on my site it works ok when anyone submits the form and the confirmation page opens ok. The prob I have...
    2. Contact form with DateField
      I hope someone can help me with this because I can't get it to work myself. I have created an contact form with Flash and in this form there is a...
    3. Contact Us Form
      Can somebody please give me a simple script for a form that is going to be sent to design@netzed.co.uk. Has a text field for contact name, email...
    4. PHP and contact form
      I'm a virgin at PHP, so go easy. :) I have a contact form and a separate PHP script that I'm attempting to author. I have no problem with it...
    5. Prevent scroll in parent window?
      My page consists of a large graphic (an organization chart). I'm using an image map with hotspots to allow the user to click on any node of the...
  3. #2

    Default Re: Contact Form (php) - how to prevent new window

    Sounds like the PHP contact.php is sending back whitespace (tabs, spaces,
    returns), text or html.

    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "yself" <webforumsuser@macromedia.com> wrote in message
    news:e57l4g$cma$1@forums.macromedia.com...
    My contact form works just fine, however, I currently have the target set to
    "_blank" which is not what I want.

    Rather than opening the .php file open in a new window, I just want to go
    to a
    new frame (labeled "success" or "error") within my flash file (which
    currently
    works fine)

    So, my question is how do I send the form information to my php file
    WITHOUT
    having to open a new window outside of my flash file since I'm sending the
    user
    to new frame instead.

    FYI: I've already tried removing "_blank" but it still opens the php file
    in a
    new browser window.

    My code below:

    on (release){
    var my_lv:LoadVars = new LoadVars();

    my_lv.fullName = fullName_txt.text;
    my_lv.email = email_txt.text;
    my_lv.emailMessage = emailMessage_txt.text;

    if(fullName_txt.text != "" && email_txt.text != "" &&
    emailMessage_txt.text
    != "") {
    my_lv.send("contact.php","_blank","POST");
    gotoAndStop("success");
    }
    else {
    gotoAndStop("error");
    }
    }

    Any help is greatly appreciated.

    Yvonne


    Motion Maker Guest

  4. #3

    Default Re: Contact Form (php) - how to prevent new window

    Encapsulating the code into three functions will make it easier to debug,
    try this:

    //Begin ActionScript:
    on(release){
    doCheck();
    }

    function doCheck(){
    if(fullName_txt.text != "" && email_txt.text != "" && emailMessage_txt.text
    != "") {
    doSendLoad();
    } else {
    gotoAndStop("error");
    }
    }

    function doSendLoad(){
    var mysend_lv:LoadVars = new LoadVars();
    var myload_lv:LoadVars = new LoadVars();

    mysend_lv.fullName = fullName_txt.text;
    mysend_lv.email = email_txt.text;
    mysend_lv.emailMessage = emailMessage_txt.text;

    myload_lv.onLoad = function(success) {
    if(success){
    if(this.nResult == "Fail"){ //here "this" refers to myload_lv, I used
    "nResult" so as not to muddy up a Flash keyword
    gotoAndStop("error");
    } else {
    //you could also load in more info here using "this.someOtherVar1"
    or "this.someOtherVar2" (see below)
    gotoAndStop("success");
    }
    }
    }

    mysend_lv.sendAndLoad("contact.php", myload_lv, "POST"); //you have to use
    sendAndLoad if you want to receive info
    }//end ActionScript

    //Begin PHP:
    //do the database hookup
    //do the database query

    //if the query fails
    print("&nResult=Fail");
    exit;

    //if the query is a success, you could send more info back
    $moreInfo1 = someQueriedInfo1;
    $moreInfo2 = someQueriedInfo2;

    print("&nResult=OK&someOtherVar1=$moreInfo1&someOt herVar2=$moreInfo2");
    //etc....
    exit;
    //end PHP

    //It can be frustrating to get this working the first time, but this should
    point you in the right direction.

    richard

    "Motion Maker" <macromedia@osfordusahay.com> wrote in message
    news:e5kf9a$7on$1@forums.macromedia.com...
    > Sounds like the PHP contact.php is sending back whitespace (tabs, spaces,
    > returns), text or html.
    >
    > --
    > Lon Hosford
    > [url]www.lonhosford.com[/url]
    > May many happy bits flow your way!
    > "yself" <webforumsuser@macromedia.com> wrote in message
    > news:e57l4g$cma$1@forums.macromedia.com...
    > My contact form works just fine, however, I currently have the target set
    to
    > "_blank" which is not what I want.
    >
    > Rather than opening the .php file open in a new window, I just want to go
    > to a
    > new frame (labeled "success" or "error") within my flash file (which
    > currently
    > works fine)
    >
    > So, my question is how do I send the form information to my php file
    > WITHOUT
    > having to open a new window outside of my flash file since I'm sending the
    > user
    > to new frame instead.
    >
    > FYI: I've already tried removing "_blank" but it still opens the php file
    > in a
    > new browser window.
    >
    > My code below:
    >
    > on (release){
    > var my_lv:LoadVars = new LoadVars();
    >
    > my_lv.fullName = fullName_txt.text;
    > my_lv.email = email_txt.text;
    > my_lv.emailMessage = emailMessage_txt.text;
    >
    > if(fullName_txt.text != "" && email_txt.text != "" &&
    > emailMessage_txt.text
    > != "") {
    > my_lv.send("contact.php","_blank","POST");
    > gotoAndStop("success");
    > }
    > else {
    > gotoAndStop("error");
    > }
    > }
    >
    > Any help is greatly appreciated.
    >
    > Yvonne
    >
    >

    dParser Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139