View previous topic :: View next topic |
Author |
Message |
Modulok Rated XXX
Joined: 19 Oct 2005 Posts: 2120 Location: New Jersey
|
Posted: Tue, 07 Nov 2006 15:44:09 Post Subject: Anyone know PHP? |
|
|
I'm wondering if anyone knows how to define variables in a PHP module for IIS. (Apache does this automatically, but the host for my work web site is Windows) I included a sample of the errors.
Code: | Notice: Undefined variable: msg in E:\InetPub\wwwroot\domain.com\survey\sendmailsurvey.php on line 17
Notice: Undefined variable: name in E:\InetPub\wwwroot\domain.com\survey\sendmailsurvey.php on line 35 |
and here is the whole php doc Code: | <?
#**************************************************************************************************************************************
# PHP Send Mail Script *
# The following script takes the information that a users inputs into the form and is mailed to the addresse(s) listed below. *
#**************************************************************************************************************************************
$MailTo = "user@domain.com"; //email the results are sent to sepearted with a comma
$MailSubject = "Customer Satisfaction Survey - 2006"; //subject field
$msg .= "
<script language=\"JavaScript\" type=\"text/JavaScript\">
alert(\"Your Information has been submitted. Thank you for your time.\")
window.location=\"http://www.domain.com\";
</script>
"; //this is the javascript message that appears after the form is submitted.
/* Fields that are sent in the main body of the message. These can be edited but must match the name field on the form. */
if ($name == ""){
}
else {
$MailBody = "Name:\n-$name\n";
}
if ($company == ""){
}
else {
$MailBody .= "Company:\n-$company\n";
}
if ($title == ""){
}
else {
$MailBody .= "Title:\n-$title\n";
}
if ($address == ""){
}
else {
$MailBody .= "Address:\n-$address\n";
}
if ($email == ""){
}
else {
$MailBody .= "Email:\n-$email\n";
}
if ($telephone == ""){
}
else {
$MailBody .= "Telephone Number:\n-$telephone\n";
}
if ($cust1 == ""){
}
else {
$MailBody .= "Our ability to accurately process your order:\n-$cust1\n";
}
if ($cust2 == ""){
}
else {
$MailBody .= "The ways questions / special requests are handled:\n-$cust2\n";
}
if ($time1 == ""){
}
else {
$MailBody .= "Adequacy of our standard lead times:\n-$time1\n";
}
if ($time2 == ""){
}
else {
$MailBody .= "Ability to deliver product on promise dates:\n-$time2\n";
}
if ($responsive == ""){
}
else {
$MailBody .= "Adequacy of our response time:\n-$responsive\n";
}
if ($package == ""){
}
else {
$MailBody .= "Ability to package products to prevent shipping damage:\n-$package\n";
}
if ($quality1 == ""){
}
else {
$MailBody .= "Ability to consistently deliver defect free products:\n-$quality1\n";
}
if ($quality2 == ""){
}
else {
$MailBody .= "Ability to deliver correct quantity:\n-$quality2\n";
}
if ($price1 == ""){
}
else {
$MailBody .= "Is our product and service competitively priced compared to companies delivering similar products:\n-$price1\n";
}
if ($price2 == ""){
}
else {
$MailBody .= "Are you receiving good value (product & service) for the price:\n-$price2\n";
}
if ($overall == ""){
}
else {
$MailBody .= "How do you rate Weiss-Aug as a supplier:\n-$overall\n";
}
if ($improvement == ""){
}
else {
$MailBody .= "Please tell us if there are any areas regarding our products & service in need of improvement:\n-$improvement\n";
}
if ($competitor1 == ""){
}
else {
$MailBody .= "Competitor:\n-$competitor1\n";
}
if ($rating1 == ""){
}
else {
$MailBody .= "Competitor Rating:\n-$rating1\n";
}
if ($competitor2 == ""){
}
else {
$MailBody .= "Competitor:\n-$competitor2\n";
}
if ($rating2 == ""){
}
else {
$MailBody .= "Competitor Rating:\n- $rating2\n";
}
if ($competitor3 == ""){
}
else {
$MailBody .= "Competitor:\n-$competitor3\n";
}
if ($rating3 == ""){
}
else {
$MailBody .= "Competitor Rating:\n-$rating3\n";
}
//Send message code
{
mail($MailTo, $MailSubject, $MailBody, "From: $email");
}
?>
<html>
<head>
<title>Thank You</title>
</head>
<body>
<? echo "$msg" ; ?>
</body>
</html>
|
Last edited by Modulok on Wed, 08 Nov 2006 13:07:01; edited 2 times in total |
|
Back to top |
|
|
Little Bruin
Boo Boo
Joined: 07 Apr 2003
Posts: 667
Location: Pic-A-Nic Basket |
|
|
Doctor Feelgood Arrrrghh!
Joined: 07 Apr 2003 Posts: 20349 Location: New Jersey
|
|
Back to top |
|
|
Modulok Rated XXX
Joined: 19 Oct 2005 Posts: 2120 Location: New Jersey
|
|
Back to top |
|
|
Blue|Fusion Rated XXX
Joined: 30 May 2005 Posts: 441 Location: Cleveland, OH
|
Posted: Tue, 07 Nov 2006 16:39:47 Post Subject: |
|
|
As far as I'm aware, you need to close the quotes (that seems to be a double quote) and take the period out before the = sign.
if you're looking to see if this variable has been set, try if(isset($name)) instead.
By the looks of it, you may want register_globals on. If that's the case, reconsider the coding. Register_globals is usually looked down upon. _________________ 5 home-built PCs, ASUS A6Jc Laptop, and a PowerEdge 2650 - all running Gentoo. Now if only I can get a car and plane to run it. Take a look at my Gallery! |
|
Back to top |
|
|
Modulok Rated XXX
Joined: 19 Oct 2005 Posts: 2120 Location: New Jersey
|
|
Back to top |
|
|
craigp Rated PG
Joined: 12 Oct 2006 Posts: 4 Location: Homer City, PA
|
|
Back to top |
|
|
Modulok Rated XXX
Joined: 19 Oct 2005 Posts: 2120 Location: New Jersey
|
|
Back to top |
|
|
Little Bruin
Boo Boo
Joined: 07 Apr 2003
Posts: 667
Location: Pic-A-Nic Basket |
|
|
Blue|Fusion Rated XXX
Joined: 30 May 2005 Posts: 441 Location: Cleveland, OH
|
Posted: Tue, 07 Nov 2006 21:10:21 Post Subject: |
|
|
Can we see the full PHP script? _________________ 5 home-built PCs, ASUS A6Jc Laptop, and a PowerEdge 2650 - all running Gentoo. Now if only I can get a car and plane to run it. Take a look at my Gallery! |
|
Back to top |
|
|
Modulok Rated XXX
Joined: 19 Oct 2005 Posts: 2120 Location: New Jersey
|
|
Back to top |
|
|
Blue|Fusion Rated XXX
Joined: 30 May 2005 Posts: 441 Location: Cleveland, OH
|
Posted: Wed, 08 Nov 2006 13:39:38 Post Subject: |
|
|
Try setting the variables since register_globals is not getting the info from IIS.
Code: | $name = $_POST['name'];
$company = $_POST['company'];
$address = $_POST['address'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$cust1 = $_POST['cust1'];
etc... |
This will fetch the POST data from the submitted form and assign it to a variable. Just put that above the rest of the stuff and see what happens. |
|
Back to top |
|
|
|