Hello Everyone,

I was wondering if the wisest among you could assist me by taking a look at the code below and helping me figure out why it doesn't function correctly when added as php node. The script works properly as a .php file but unfortunately when I added to drupal as a php node it does not function (http://207.44.143.4/computers4you_drupalv/node/view/5). Any input would be well appreciated. And the reason I don't use the feedback module is because there is more I need to add to this page/script which I don't know how to hack into the module.

Thanks for the input.

code
--------------------
$form_block = "
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
id=text align=\"center\">
<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">

<tr><tr><td >

<P><strong>Select Department</strong><br>

<select name=\"email_to\">
<option value=\"0\">Select Department</option>
<option value=\"contact@computers4you.ca\">General Inquiry</option>
<option value=\"sales@computers4you.ca\">Sales</option>
<option value=\"prequest@computers4you.ca\">Product Request</option>
<option value=\"webmaster@computers4you.ca\">Webmaster</option>
</select><br>

<P><strong>Your Name:</strong><br>
<INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\"
SIZE=30></p>
<P><strong>Your E-Mail Address:</strong><br>
<INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\"
SIZE=30></p>

<P><strong>Subject:</strong><br>
<input type=\"text\" name=\"subject\"; value=\"$subject\"
size=30>
</p>

<P><strong>Message:</strong><br>
<TEXTAREA NAME=\"message\" COLS=50 ROWS=8 WRAP=virtual>$message</TEXTAREA></p>

<INPUT type=\"hidden\" name=\"op\" value=\"ds\">

<P align=center><INPUT TYPE=\"submit\" NAME=\"submit\"
VALUE=\"Send\" class=button></p>

</FORM>
</table>

";

if ($op != "ds") {

// This are the error messages on the required fields you can add or delete
echo "$form_block";

} else if ($op == "ds") {

if ($email_to == "0") {
$department_err = "<font color=red>Please select correct department!</font><br>";
$send = "no";
}

if ($sender_name == "") {
$name_err = "<font color=red>Please write your name!</font><br>";
$send = "no";
}

if ($sender_email == "") {
$email_err = "<font color=red>Please write your e-mail!</font><br>";
$send = "no";
}

if ($message == "") {
$message_err = "<font color=red>Please write your message!</font><br>";
$send = "no";
}

if ($send != "no") {

// this is the info that comes on the email when it's ok to send!
$msg .= "Greetings,\n\n";
$msg .= "$message\n\n";
$msg .= "$sender_name\n";
$msg .= "$sender_email\n";
$to = "$email_to";
$subject = "$subject";
$mailheaders = "From: $sender_email\n";
$mailheaders .= "Reply-To: $sender_email";

mail($to, $subject, $msg, $mailheaders);

echo "We will be back in touch with you within 72 hours thank you!";
} else if ($send == "no") {

echo "$department_err";
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";

}

}

Comments

topogijo’s picture

Hello,

Can someone test the script above on their drupal 4.2 installation to see if it works for them?

Regards,
Topo