Dear Sir,
I have a mail form ( file name: sendresults ) in php. This php code supports the sending all text of the checkboxes of Register Page of a website. But it does't send attachement ( word, excel, jpg, image, etc. )
Now , I want to add the attachement code and a javascript of "thank you" pop-up window in the script I am using.
My code is as under:
<?php
//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'Test mail';
// Your email address. This is where the form information will be sent.
//$emailadd = 'career@icfa.co.in';
$emailadd = 'basu.biswas@gmail.com';
// Where to redirect after form is processed.
$url = 'http://www.icfa.co.in/register.php';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, $attachement, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
// send the message
// mail("$to_name <$to_email>", $subject, $message, $headers);
if (
mail("$to_name <$to_email>", $subject, $message, $headers);
) {
echo '<p>Send successfully!</p>';
} else {
echo '<p>Bah!</p>';
}
print "Mail sent. Thank you for using ICFa web Mailer.";
echo '("<script language = 'javascript'>window.alert('Mail sent Successfully !')</script>")';
?>
pl. help with attachement code of any file and a javascript of "thank you" pop-up window.
thanks in adv.
roy