php code error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phish007
Forum Newbie
Posts: 2
Joined: Fri Sep 02, 2005 10:38 am
Location: graphic designer

php code error

Post by phish007 »

Hey guys im new to the forums..hoping maybe you can help me though..I developed a flash basec contest form. you can see it at http://www.zeroxposur.com/test then click on contest.. Anyways after you fillit out it sends me the email..however the only info that comes though is " From Undefined" heres my php code..did I do something wrong?

Code: Select all

<?php

$name = $_POST["name"];
$email = $_POST["email"];
$address = $_POST["address"];
$state = $_POST["state"];
$zipcode = $_POST["zipcode"];
$sex = $_POST["sex"];
$city = $_POST["city"];
$about = $_POST["about"];
$color = $_POST["color"];
$athlete = $_POST["athlete"];
$game = $_POST["game"];
$music = $_POST["music"];
$create = $_POST["create"];

$to = "webmaster@zeroxposur.com";
$subject = "Contest Form Info";
$body = "{$name} email is {$email} their address is {$address} and the state they reside in is {$state} who's zipcode is {$zipcode} {$name} is a {$sex} who wrote this as a description of themselves{$about} Their favorite athlete is {$athlete} their favorite game is {$game} Their favorite music is {$music} and if they could create a jacket they would do the following {$create}";

$result = @mail($to, $subject, "From: {$email}\r\n");

if($result) {
  echo "result=email sent";
} else {
  echo "result=email failed to send";
}

?>

feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your code appears okay, is it possible your form is incorrect?

Side note: the form is too tall for some displays, and since it doesn't scroll.. kinda a problem. :)
phish007
Forum Newbie
Posts: 2
Joined: Fri Sep 02, 2005 10:38 am
Location: graphic designer

Post by phish007 »

ok so if the php is good to go..maybe my form actionscript is off then...Are u familiar with flash actionscript at all? thanks for the tip with the display! Ill have to fix that aswell
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sadly, no. I'm not familiar with ActionScript at all right now.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

Code: Select all

@mail($to, $subject, "From: {$email}\r\n");
taking off the '@' symbol might give some warnings or errors which can be a clue to the problem.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

:oops: just noticed, you forgot to place $body in the mail() call, as well.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

If you still did not get it working, let me know.. I'm okay at flash actionscript.
Post Reply