Jump to content


PHP Form


13 replies to this topic

#1 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 08 December 2007 - 10:53 PM

Hi everyone, so I checked the sticky sites that are on here and quite honestly I dont know what I'm looking for so I thought I would ask here so here is my problem. I have created a flash quote form that calls on a email.php form. Now the flash portion works great I have no problems there and all my actionscript is correct, or at least I think. My problem is that when you fill out the form, name, subject, message, email. When I receive the input information, all I get is the message, no response email or anything like that. I did this off of a tutorial on the internet so I know nothing of what is wrong so here is the code and maybe you can help me....Like I said all I get is the message but nothing else? Any ideas? Also I'm using Firefox when I do it, I dont know if this makes a difference....Kyle

$sendTo = "Kyle@459productions.com";
$subject = "Web Quote";

$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];

$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);


#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 08 December 2007 - 11:13 PM

Try simple debugging.

print_r($_POST);

That will show you what is being sent through POST data to PHP. If it only shows your message variable, then there is a problem with your ActionScript and you'll need to show us. If it is there, then there is something else going on, such as possibly not accessing the correct key of the array (example, accessing $_POST['firstName'] when in the form it is sent to $_POST['first_name']).

#3 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 08 December 2007 - 11:15 PM

ok so if I add your code to that php when it goes to run the php file it will also show me what is running?

#4 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 08 December 2007 - 11:21 PM

Place that as your first bit of PHP code and it will output the full $_POST superglobal (the data sent by the form).
Be sure also that your Flash form is sending it by POST protocol, and not GET.

#5 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 08 December 2007 - 11:29 PM

I put your bit in front of everything else and did a quick test. I'm not sure where it is suppose to output too like your saying? But I got the email and once again all I got was the message portion. But like I said I'm a total newbie so I dont know where the output is or what I'm looking for? Here is the AS I used.

My Form Movie Clip has this
onClipEvent(data){

   _root.nextFrame();

}

The Send Button Has this
on (release) {
	
	form.loadVariables("email.php", "POST");
}


#6 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 08 December 2007 - 11:54 PM

The result of print_r() will be posted on the webpage...

When dealing with emailing, you should test everything for the message and how it will be outputted before sending the message. Otherwise you'll not only waste resources and spam up your inbox, you could get yourself into trouble for spamming on your host if you do it too much and too often at once.

Take out the mail() function (or comment it out atleast) for now, and just focus on getting those variables passed correctly.

#7 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 09 December 2007 - 12:37 AM

Ok when I tested it and I think I did this right, I put in the print_r() and I only got Array()

Now I put it in front as well like you said, so it must be the Action Script then?

#8 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 09 December 2007 - 12:51 AM

Yes, that means that no data is even being sent to PHP.

Try further debugging by outputting the contents of $_GET to see if the data is somehow being sent the wrong way.

#9 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 10 December 2007 - 01:01 PM

I still only get Array().....Maybe I'm checking it wrong? Because how I'm checking it is just by going to the direct address of my php file on my server, or is there another way?

Any ideas? Anyone?

Edited by rc69, 13 December 2007 - 03:22 PM.


#10 shameless_w_o_a_d

    Young Padawan

  • Members
  • Pip
  • 42 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:Web Design, Graphics Design, Computers, Games, Music, Basketball

Posted 14 December 2007 - 04:01 AM

Hi, 459Productions. :rolleyes:

I read that you were having some problems with PHP and thought I'd try to help you out. Could you please provide the code that is used for PHP? At this stage, from my understandings, this would only be the form used (unless this is provided within flash itself, in which case ignore this part of the request), and the email.php file.

Let's see if we can fix this sucker! :D

#11 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 14 December 2007 - 12:15 PM

Hey thanks for the help! I hope we can figure this out. I have tested it and all i get is the Array() so my variables aren't even going through. I tested another one of my forms and it does not work either! I just switched to a new host as well, could there be something I have to enable for these to work?

Here is my email.php code and my Flash Actionscript is above as well.
$sendTo = "Kyle@459productions.com";
$subject = "Web Quote";

$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";

$headers .= "Reply-To: " . $_POST["email"] . "\r\n";

$headers .= "Return-path: " . $_POST["email"];

$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);


#12 shameless_w_o_a_d

    Young Padawan

  • Members
  • Pip
  • 42 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:Web Design, Graphics Design, Computers, Games, Music, Basketball

Posted 17 December 2007 - 01:00 AM

View Post459Productions, on Dec 15 2007, 06:15 AM, said:

Hey thanks for the help! I hope we can figure this out. I have tested it and all i get is the Array() so my variables aren't even going through. I tested another one of my forms and it does not work either! I just switched to a new host as well, could there be something I have to enable for these to work?

Sorry I took so long to reply, it has been a few busy days for me with Christmas creeping ever so closely to being here!

Your PHP script is fine - although the integrity of the script is debatable, since you have no sanitisation checks to make sure people don't just send you a blank email, which is quite possible with the current state of the script. But we'll cross that bridge when we get to it.

Looking up the ActionScript Dictionary on Adobe's site seems to indicate that the potential problem may be your lack of parameters for loadVariables().

loadVariables( " url ", level/ " target " [, variables ])

You have defined the url and the optional variables parameters, but the level or the "target" of the action call doesn't appear to exist. I believe that's a step in the right direction to fixing it. ;)

#13 459Productions

    Young Padawan

  • Members
  • Pip
  • 164 posts

Posted 17 December 2007 - 02:56 PM

What would I need to add in for the target and level?

#14 shameless_w_o_a_d

    Young Padawan

  • Members
  • Pip
  • 42 posts
  • Gender:Male
  • Location:New Zealand
  • Interests:Web Design, Graphics Design, Computers, Games, Music, Basketball

Posted 18 December 2007 - 05:28 AM

Well, reading into the documentation for the function some more, it refers to how the levels work, and that if you had a movie clip instance in your Flash document and it was the first thing loaded, it can be accessed by typing _level0 in your code, so how it works seems to allow certain things to load in one level one time, load in a completely different level the next based on how quickly the assets load.

One thing you need to understand, is that you pick either the level or the target, it cannot be both. It sounds like you'd be better off to go with the target attribute to that one, and if the documentation is anything to go by, it is the path to a movie clip in your Flash document. The example on the page might answer it for you, since it appears to be the way you go about the target for the function's parameter.

I'm not very experienced in Flash, since I only know the dead basics and haven't really delved into Actionscript for this sort of functionality, so you might have to ask someone who's more experienced in Flash in regards to that question. I'll try to create a mock up of what you're wanting tomorrow, and if I manage to get it working, I'll pass on my working examples to you so you can look at it and hopefully you can learn some things from it in turn. Of course, this is not to say that I may be busy and won't be able to do it for some time, but I wil ltry my best to get it done. -_-





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users