Log in

View Full Version : mail function in php



sukanya.paul
11-08-2007, 04:33 AM
i have a form with all sorts of details which whn submitted the details are entered into the database and a mail should be sent to the owner's email id with all the details..
the mail functon is not working..i had entered a demo mail function in my code but thts not working also.
this is really imp can someone pls help.

thanks in advance..
suk'

the code i had written is:he code marked in red does not work..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
echo "hhhvhvh";
include 'db.php';
$valid=false;
$sql="INSERT INTO `tbl_contact` (
`first_name` ,
`middle_name` ,
`last_name` ,
`street1` ,
`street2` ,
`city` ,
`pincode` ,
`state` ,
`country` ,
`country_code` ,
`area_code` ,
`contact_num` ,
`email` ,
`organization` ,
`topic` ,
`comment` ,
`date`
)
VALUES (
'".$_POST['fname']."','".$_POST['mname']."','".$_POST['lname']."','".$_POST['street1']."','".$_POST['street2']."','".$_POST['city']."','".$_POST['pin']."','".$_POST['state']."','".$_POST['country']."','".$_POST['ccode']."','".$_POST['acode']."','".$_POST['contact']."','".$_POST['email']."','".$_POST['org']."','".$_POST['topic']."','".$_POST['comment']."','".$_POST['date']."')";
echo $sql;
//exit;
if(mysql_query($sql,$con))
$valid=true;

if ($valid)
{

$txt = "First line of text\nSecond line of text";// Use wordwrap() if lines are longer than 70 characters
$txt = wordwrap($txt,70);// Send email
mail("sukanya.p@brickworkindia.com","My subject",$txt);

echo("<script>location.href ='thankyou.php'</script>");
}
else
echo("<script>location.href ='contact_us.php'</script>");

?>
</body>
</html>

sukanya.paul
11-15-2007, 04:47 AM
110 ppl read this post but could not reply??surprising!!!!

djr33
11-15-2007, 05:22 AM
Seems to be correct.

Is PHP installed/working on that server?

Is there any error?

Are you on a windows server? With Godaddy by chance?

sukanya.paul
11-15-2007, 05:24 AM
well i got it solved but used some other code.. ya doin it with GoDaddy..
thanks anyways :)

djr33
11-15-2007, 06:14 AM
Godaddy's windows servers have a few very screwed up elements with PHP, and the mail tag is basically disabled. So, there's your answer.

sukanya.paul
11-15-2007, 06:16 AM
ok..wekk no problem.. i used something else and got it resolved..
thanks for the reply though...

Shotgun Ninja
11-20-2007, 03:50 PM
Godaddy's windows servers have a few very screwed up elements with PHP, and the mail tag is basically disabled. So, there's your answer.

Dammit. Well, strike that from my website...:mad:

boogyman
11-20-2007, 05:02 PM
Dammit. Well, strike that from my website...:mad:

thats why its important to compare hosting plans against something other then just price..