hello i have thsi script and it is not working for me. i know php works because when i use a simpler emailer it works fine what am i doing wrong here. I have had this working before and i just changed some stuff and now it is not working. also if anyone could explain the mail() function in php like if i was 10. well thanks for reading. Patrick
hi there, you firstly need to read some tutorials on flash php as there are many a error in your script, after reading the script take a look at my comments at the bottom for comments.
$msg = "Swedish Design Order Number: $serial\n";
$msg .= "Sender's First Name: $firstname\n";
$msg .= "Sender's Last Name: $lastname\n";
$msg .= "Address: $address\n";
$msg .= "City: $city\n";
$msg .= "Province/State: $province\n";
$msg .= "Country: $country\n";
$msg .= "Zip Code: $zip\n";
$msg .= "Area Code Is: $areaphone\n";
$msg .= "Phone Number is: $phone\n";
$msg .= "Sender's E-Mail: $email\n";
$msg .= "Senders Host Address: $REMOTE_ADDR\n";
$msg .= "Senders IP Address: $ip\n\n;
mail($recipient,$subject,$msg,$mailheaders) or die ("couldn't send mail");
?>
____________________________________________
Why your script didn't work...
1) you missed the top lines of code. also finish adding in the rest of the varible names, eg.( if (($serial == "") )
this makes sure that the variables that are being sent to flash have a value.
2) $REMOTE_ADDR does not get the ip address, it is the isp's info, so that is why i added the coding to $REMOTE_ADDR and your $msg.
3) your format was wrong in the $msg areas, as you can see i removed unwanted lines.
4) you should also attach a date function so you can see when the mail was sent.
hey thanks alot. yeh i am looking for a good book to learn from in our library because i have only used action dcripting which i like to think i am good at. i just get stuck learning new things. well thanks again you really helped. Patrick
no prob, i am not used to php also, but have looked over many a code and after a while it gets easier, here is a link to some flash php tutorials if your interested...
Now i am really comfused. if there a limmit on how mnay workd you can have in it because my little cript worked just fine. Thanks for the link but, most of it was way too complicated.
you're script was workable.. it just had a couple of syntax errors.
you might have to add 'php' to the opening tag in order for your ISP's server to parse the file correctly..
<?php
and you missed a semi-colon on this line..
$msg .= "Senders IP Address: $REMOTE_ADDR"
protocol's script added some good features such as verifying that there was data and verifying the remote IP.. but with the two changes above your script should at least mail and give you the input your looking for...
Hello,
here is an addition to what protocal supplied..
This code is from Musicmans sticky within this forum..
PHP's new security for passing of variables means that you must declare the variable that is being passed(PHP 4.1 and above), or the script will fail..
I think I have this right, but it might be a good idea to look into this:
thanks for adding to the code 3PRIMATES, i will use it to update my script. currently the script is working fine so if i change it by adding these lines will it still work ???
btw, does anyone know more commands for the mail form, if so add them to the code, it would be a great way for others to learn...
hello, i am sorry to bother you huys but it still does not work. i have made the file a while ago and i am bringing it back to life. why would the script not work. here is the fla and the php that i am usiing
Hi, Im so sorry..
I found some syntax errors later..
I have gone ahead and added a few more bells and whistles to this..
this should work, but if you are still having problems let me know..
Use the attached file, dont copy and paste from this message:
PHP Code:
<?php
## putting your form variables into an array
$postvars = array("serial", "firstname", "lastname", "address", "city", "province", "country", "zip", "areaphone", "phone", "email");
foreach ($postvars as $var)
## each item in the array is output as a post variable
## example: serial above is now $_POST['serial'];
if(isset($_POST[$var]))
$$var = $_POST[$var];
## error message option 2: self contained error message
## comment out 4 lines below if using option 1
if (($serial == "") || ($firstname == "") || ($lastname == "") || ($address == "") || ($city == "") || ($province == "")) {
echo "<td bgcolor='8C96D3'><b>Incomplete Data:</b><br>Please fill in all required fields and try again</td>";
exit;
}
## retreiving the users ip address if available, if not available $ip = no ip
if ($REMOTE_ADDR == ""){
$ip = "no ip";
}
else
{
$ip = getHostByAddr($REMOTE_ADDR);
}
## date printed on email
$date = date("l dS of F Y h:i:s A");
## The @ character in front of mail function supresses any php error messages that would be output to the user
@mail($recipient,$subject,$msg,$mailheaders) or die ("<td bgcolor='C8010D'><b>Mail server error:</b><br>We are sorry, your mail could not be sent at this time.<br> If you continue to recieve this error, please contact the <a href='mailto:$recipient'>webmaster</a></td>");
?>