Well, one of the most common problems encountered here is forms / global variables. The form on your page is using the post method, so chances are, you need to reference your variables by the global post array, ie

$_POST['custemail']
$_POST['request_type']
etc.

Instead of $custemail and $request_type. If the form is using the get method (or any time variables are being passed in the URL), you'll want to use the global get array, ie

$_GET['some_variable']
$_GET['anoter_variable']

Then there's the global request array which will get all types passed to the page, ie.

$_REQUEST['some_variable']

You may want to take a look here for a better explanation of variables and scope...

http://www.php.net/manual/en/language.variables.scope.php
http://www.php.net/manual/en/language.variables.external.php

Julie Williams wrote:
Hi John,

The variables are coming from a form, located at:

http://www.swedishengineering.com/newsite/requestresponse.html

I don't know what version of PHP or if the global variables are on or off.
I would have to ask the client who their provider is and contact them.  I'm
guessing you're asking me this because you don't see anything wrong with the
script's logic?

Julie

-----Original Message-----
From: John Nichel [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 8:10 AM
To: Julie Williams
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Introduction


Julie,

What version of PHP?  Where is $custemail coming from, form on another
page/same page, database?  Global variables on or off in your php.ini?

Julie Williams wrote:

Hi Jason,

Sorry, I'm very new to this.  Since my code is not huge, I have included
it

below.  I removed some of the text so that it is less bulky.  I hope
everything is clear.  Thanks for your help!


<?php
//Build email  Body based on customer request
IF (isset($custemail)) {
  IF ($request_type=="Service_Advice") {
     $body = "Thank you for your request for service information...";
     $body .= $comments;
     $headers .= "MIME-Version: 1.0\r\n";
     $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
     $headers .= "From: [EMAIL PROTECTED]\r\n";
     $headers .= "To: ".$custemail."\r\n";

     mail($custemail, "Your Service Advice Request", $body, $headers);

     header("Location:index.html");
	}
  ELSE IF ($request_type=="Parts_Advice") {
    $body = "Thank you for your request for parts information...";
    $body .= $comments;
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: [EMAIL PROTECTED]\r\n";
    $headers .= "To: ".$custemail."\r\n";

    mail($custemail, "Your Parts Advice Request", $body, $headers);

    header("Location:index.html");
	}
 ELSE IF ($request_type=="Parts") {
    IF ((!isset($part1)) && (!isset($part2)) && (!isset($part3))
       && (!isset($part4)) && (!isset($part5)) && (!isset($part6)))
       print ("Please go back and include part information!");
    ELSE {
       $body = "Thank you for your parts request.  The information you
requested is listed below:<BR>&nbsp;<BR>";
       $body .= "<TABLE>";
       $body .= "<TR><TH>Part #</TH><TH>Part
Name</TH><TH>Price</TH><TH>Shipping</TH><TH>Availability</TH></TR>";
       IF (isset($part1))
          $body .=

"<TR><TD>$part1</TD><TD>$partname1</TD><TD>$price1</TD><TD>$sprice1</TD><TD>

$avail1</TD></TR>";
       IF (isset($part2))
          $body .=

"<TR><TD>$part2</TD><TD>$partname2</TD><TD>$price2</TD><TD>$sprice2</TD><TD>

$avail2</TD></TR>";
       IF (isset($part3))
          $body .=

"<TR><TD>$part3</TD><TD>$partname3</TD><TD>$price3</TD><TD>$sprice3</TD><TD>

$avail3</TD></TR>";
       IF (isset($part4))
          $body .=

"<TR><TD>$part4</TD><TD>$partname4</TD><TD>$price4</TD><TD>$sprice4</TD><TD>

$avail4</TD></TR>";
       IF (isset($part5))
          $body .=

"<TR><TD>$part5</TD><TD>$partname5</TD><TD>$price5</TD><TD>$sprice5</TD><TD>

$avail5</TD></TR>";
       IF (isset($part6)){
          $body .=

"<TR><TD>$part6</TD><TD>$partname6</TD><TD>$price6</TD><TD>$sprice6</TD><TD>

$avail6</TD></TR>";
          $body .= "</TABLE>";
          $body .= "Our Service departments are located on the following
page:<BR>&nbsp;<BR>";
          $body .= $comments;
          $headers .= "MIME-Version: 1.0\r\n";
          $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
          $headers .= "From: [EMAIL PROTECTED]\r\n";
          $headers .= "To: ".$custemail."\r\n";

          mail($custemail, "Your Parts Request", $body, $headers);

          header("Location:index.html");
    	    }
	}
  }
  ELSE {
       print ("Please go back and enter the customer's request type!");
   	 }
}
ELSE {
     print ("Please go back and enter the customer's email address!");
	  }
?>



-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 6:15 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Introduction


On Saturday 01 February 2003 00:47, Julie Williams wrote:



Basically, all the script does (or should do) is build an e-mail to a
client based on a set of variables defined by the user, using an HTML
form.


It is also supposed to warn the user with a "print" message whenever a
variable is missing.  The form is at the following address:
http://www.swedishengineering.com/newsite/requestresponse.html

I've saved the script in text format so that you can look at, it is
located


at the following address:
http://www.swedishengineering.com/newsite/requestresponse.rtf

If your code isn't humungous then you should include it (inline, not as an
attachment) with your post. There are many reasons why people would not
click
on a link to see your code (laziness, or fear of being social-engineered
to

spread the latest MS-related exploit etc).

If your code _is_ humungous, then a link might be appropriate and note
saying
_why_ you're posting a link would be nice.


Also, your intent to make the code look pretty(?) by converting to RTF
seems

misguided. Stick to plain-text.



The errors are as follows:

When the customer's e-mail is omitted, a print message should appear, to
the effect of "Hey, you need to specify the e-mail!".  However, when the
e-mail is omitted *and* one of the options is clicked, the message does
not


appear, but rather, the user gets re-directed to the index page.

When the "Parts" option is chosen, but no parts are indicated, a print
message should appear to let the user know that a part number needs to be
entered.  However, the script bypasses this and builds the e-mail anyway.

I hope this makes sense and would greatly appreciate any help.

It's good you that you explain what you're trying to do, and what you
expect

the program to do, and what actually happens instead. (Some people just
say

"here's my code, it doesn't work, what's wrong?" -- or words to that
effect)

However it would make more sense if we could see some code :)


--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Sleep is for the weak and sickly.
*/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to