5 Replies Latest reply on Sep 6, 2007 6:09 AM by mkbanister

    actionsript to PHP to my email

    mkbanister
      I need to have all the clicks the user makes sent to me in an email (behind the scenes, so no button). Here is the site http://www.depthwork.com/cards/HTML/cards2.html

      I understand I need to use sendandload, and I am confused.

      Here are the variables (just the first set of cards):
      var cards:Array = ["cross", "circle", "square", "triangle", "spiral"]
      var decoder = {}
      decoder.circle = ["Self-reliant","self-reliance","null","being independent"];
      decoder.cross = ["connected to others","relationships, with yourself and others","null","relating to others"]
      decoder.square = ["responsible and reliable","accountability","null","stability"]
      decoder.triangle = ["goal-oriented","any view of the future","null","re-inventing yourself"]
      decoder.spiral = ["going through a transition","change","null","constant change"]
      var sequence:Array = [];

      To PHP code:
      decoder.SendAndLoad(" http://www.depthwork.com/cards/Flash/cardmail.php3?uniqueID="+ getTimer(), decoder, "POST");

      The PHP code:
      <?PHP
      $ToEmail = "mkb@work4media.com";

      ##$ToName = "marilyn";
      $ToSubject = "cards";

      $EmailBody = "symbol: $decoder;

      mail($ToName." <".$ToEmail.">",$EmailBody, "From: ".$decoder" <".$email.">");

      ?>

      I know this looks grade school but I am not PHP savvy except to do a contact form lol. Any help would be greatly appreciated
        • 1. actionsript to PHP to my email
          Greg Dove Level 4
          Hi,

          I don't know all of what's required on the php side.
          But (if I recall correctly) the results are in the sequence array.

          so you need to have a new LoadVars to send that data, as string values.

          //send To PHP code:
          var emailResultsUploader:LoadVars = new LoadVars();
          var confirmEmail_LV:LoadVars=new LoadVars();
          //send the sequence contents separated by semicolons (or whatever you want)
          emailResultsUploader.sequence = sequence.join(";");
          emailResultsUploader.sendAndLoad(" http://www.depthwork.com/cards/Flash/cardmail.php3", confirmEmail_LV, "POST");

          I'm am not PHP savvy either, But I have 2 recommendations. This may not fix any other errors that are there, but these parts should be changed.:

          $EmailBody = $_POST['sequence'];


          and to give a response, add in before the last ?>

          print "result=true";
          ?>

          cheers
          GWD

          • 2. Re: actionsript to PHP to my email
            Greg Dove Level 4
            Looks like clbeech has an example of the php side of things (I didn't look at it, but it sounded relevant)

            http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1298203&enterthread=y
            • 3. Re: actionsript to PHP to my email
              mkbanister Level 1
              I downloaded the files from the link and get an unexpected file format error when I try to opne the fla file..........ARG.

              Thanks,
              M
              • 4. Re: actionsript to PHP to my email
                clbeech Level 3
                Are you using Flash MX? this is a Flash8 file, I can publish down for you, if needed.

                GWD is right, you need to use the LoadVars class to send the variables, to a PHP email output. However I see some problems in your system concept here, your attempting to send Arrays within an Object to the php, that will make getting the values out of the $_POST[ ] difficult. this is why GWD has suggested converting this to a string.

                Also, when are you trying to initiate the sending of the email? if this happened every time the user clicks a button you'd get a thousand emails all the time, each with only one element or something. I would suggest re-thinking the way this works. like maybe, if all the other cards have been selected(?i dunno), on the last selection this initiates the send sequence? You may have already been doing this, but I didn't see it in the code.

                Lastly, and it's none of my business really, but what are you wanting to keep this information for? The reason I ask is, that you've already used it within the 'test' to determine the output in the final evaluation, so I can only assume that you're wanting to track the demographics of people using the 'test' (btw - according to the test, I'm suppose to be helpful :) I'm thinking that you would still need to then go through the emails and gather the info 'by hand' so to speak. If this is the case, it could be much more efficient to store the info in an online database, on a per user basis, also the time tracking info can be tracked within a DB column automatically. The same mechanisms can be used to send the info using LoadVars, but the PHP would be different and enter the info into the DB for you. You can also then download the contents of the DB at anytime into a spreadsheet program like Excel to view and analyze. You can also view it online, or build an app to do so.

                I also noticed that your sending 'decoder', when that would include all of the information in each property. I'm assuming that you would want to be getting the information from the 'sequence' array, which I also am assuming is where you are storing the choices by pushing the array by the cards being selected by the user. So I'm thinking that since you know what the information means, that you may only need to send the sequence of selected, rather than all of the text itself. Like a series: circle, sprial, triangle, square, cross ... then the next, and so on. Just a thought :) You could even then build a 'decoder' application that you could input the sequence and view the results if needed. You could even store the sequence by index number, like the above would be: 14320 or 1,4,3,2,0

                OK anyway I hope this gets you thinking about how you can reduce your problem of dealing with so many variables, and how to store them or send them. let us know what you think, and then I will help you get the info to PHP.
                • 5. Re: actionsript to PHP to my email
                  mkbanister Level 1
                  Hi,
                  I would like one email with all the clicks...I would like the answers to go to a database but....this is already waaaaaaaaaaaay over my head. We only want the answers so that if the person wants a longer reading and to go into their lives and where they are at in more detail that we already have the information to start with. They may even have questions about it. Having the database was going to be in the future if this thing really gets going.

                  I was not aware I would have this problem trying to get this part. I feel I should recreate this in HTML or some other programming, except I have got it this far. Is it possible to recreate with less problems???

                  Thanks all very much for your help,
                  M