Your if-else structure was a bit hard to oversee this way. I had to indent your code to see your logic. But maybe the tabs got lost in the email.
I think readability would improve if you replaced
--------------------------------- IF (isset($_POST['custemail'])) {//the entire script } ELSE {print "warning message";} ---------------------------------
with
--------------------------------- IF (!isset($_POST['custemail'])) { print "warning message"; exit; }
//rest of the script ---------------------------------
Then, you said:
when the client's e-mail address is omitted, a message should appear, stating "Please go back and enter the customer's e-mail address!", but instead, it states "Please go back and enter the customer's request type!" which is a message that should appear when the type is omitted.
This is about this test:
IF (isset($_POST['custemail']))
Now, probably with your browser, when this field is left empty, $_POST['custemail'] does exist, but is empty.
So you would need to test for that too:
IF (!isset($_POST['custemail']) OR (trim($_POST['custemail'])!='' ) )
(trim removes spaces)
BTW it would be a good idea to also make a javascript test for empty fields.
Also, when no parts are indicated, a message should appear, to the effect of "Please go back and enter a part" but instead, the program goes ahead and sends an empty e-mail to the customer.
That's about this test:
IF ((!isset($_POST['part1'])) && (!isset($_POST['part2'])) && (!isset($_POST['part3'])) && (!isset($_POST['part4'])) && (!isset($_POST['part5'])) && (!isset($_POST['part6'])))
And here i think it is basically the same problem as described above. I would keep it more basic here and replace every !isset($_POST['part1']) by (trim($_POST['part1'])!='') because apparently it is always set.
There are several other errors, basically, none of the commands work properly.check the script for more places where you assume that isset is valid only when somehting is entered in a field
We have been banging our heads on our desks for a really long timedon't do that! in case an IF does not do what you expect it to do, do some very basic tests in a separate script. and check the manual and see the examples.
We are beginning to think that the server is possessedOf course that IS an option, too. In that case I recommend to go to alt.exorcists.servers ;-P
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php