does loadVars work the same way with xml than php
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: does loadVars work the same way with xml than php

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    316

    does loadVars work the same way with xml than php

    Good day,

    I was reading about sending methods last night and though that I would prefer to use send tan sendAndLoad in my script because my swf doesn't need to load any response from my php file but I have tried it, with or withouth target and HTTP methods and I can't get it to work.

    I have this code:

    Code:
    var lvSend = new LoadVars();
    lvSend.from;
    lvSend.to;
    lvSend.subject;
    lvSend.missatge;
    			
    lvSend.sendAndLoad("http://localhost/sendEmail.php",lvSend,"POST");
    in an extension I am using to send an automated email reply.

    I have tried:

    Code:
     lvSend.send("http://localhost/sendEmail.php", "_blank");
     lvSend.send("http://localhost/sendEmail.php", "_blank", "POST");
     lvSend.send("http://localhost/sendEmail.php", "POST");
    either I've forgot to restart my extension after making any changes to it, or none of these ways work. Is sending php variables different?

  2. #2
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    316
    I'm just replying to my own post since I have found a post with a very similar code as mine, instead it happens in a buttonhttp://board.flashkit.com/board/show...ght=php+mailer

    I can't see why my code will be any different and i tried again today double checking each time I modified the file.

    My code runs in a class. An extension for a server; smartfox server to be precise.

    Not that I'm very worried because the email is sent, but I don't understand how it gets the information to work.

    I have been trying to populate some variables in the php script and, I just don't know what else to try or where to look for info.

    These are the vars I'm sending from the extension:

    Code:
    var lvSend = new LoadVars();
    lvSend.to;
    lvSend.subject;
    lvSend.missatge;
    
    
    // Traces that the variables are passed from the server's extension ?
    trace("to = "+to);
    trace("subject = "+subject);
    trace("to = "+missatge);
    	
    lvSend.send("http://localhost/send-email.php","POST");





    My php doesn't seem to receive any values, but it works sending a reply email on which I can't change any variable values.

    Code:
    // $subjecte = $_POST['subject'];
    // $mail->Subject = ".$subjecte";
    
    $mail->Subject = "Testing PHPMailer with localhost";
    the commented lines would represent the values I'd like to replace for the subject property. Are they wrong in syntax?

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    316
    alright, I had forgotten to define my loadvars object properly. I see now there are no values in there.

    So I did assign them and kept trying from a regular flash document until I saw something happening. That happened when I tried using _REQUEST instead of _POST in the php file. It finally worked!

    I still don't quite understand why this needed to be done with sendAndLoad... it worked with send in the normal file I tried.

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

Poll by Flashkit.com