Success:
I have coded a PHP 4.2.1 script to collect user info from a form and then send email based on the form's field entries. I have the normal if/elseif/else conditions defined, and the error and thank you message print correctly regarding the if/elseif conditions found.
I am a avid Paradox 3.5 for DOS application developer. I mention the Paradox experience for this reason: in version 3.5, PDX used C++ type syntax in its scripting. I wanted to somewhat pre-qualify my programming savvy.
What the script's mission is:
This is my Recommend-URL script. The script presents a form to the user asking for visitor's name and email and, also, at least, one recipient's name and email. The script then sends the recommendation to the recipient and sends my marketing person a pre-formatted email which is used by marketing as a tool to rate the popularity of a URL. And it also automatically indicates to marketing whether it's okay to send a thank you or other emails to the visitor who submitted the form.
Problem:
The php script mentioned above performs absolutely beautifully. However, it needs one added feature and that's where my php knowledge comes up short.
The feature needed is to instruct php to jump or skip to a pre-selected line of code in the script, hopefully initiated by the if/elseif/else condition, which calls for the user to edit one or more of the form fields and then re-submit the form.
Php reads my if/elseif statements correctly and prints the appropriate user message. However, the php flies right on down the page and sends an email regardless of the condition.
Getting to the point:
How do I instruct php in the if/elseif/else conditions to skip down to my pre-selected line of code in the script, i.e. skip the email functions when condition exists? This is needed to preempt the sending of the email to our marketing person which has no information other than the recommended URL. This happens in the case where someone submits a form with a blank field for the visitor's email address.
The question in its simplest form would be: how do I stop php from executing all the code in the script when certain conditions are NOT met? I have exhausted all web searches for information on solving this problem. EVEN A SIMPLE DOS BATCH FILE PROGRAM CAN ACCOMPLISH THIS BUT I'M NOT WRITING IN BATCH LANGUAGE. Surely, a popular program like php can provide this feature.
I realize that it is not necessary to preempt the condition mentioned above however, the results of this script would be near perfect, if not perfect, if I could solve this problem.
This script is my first php. I have learned and hope to learn, at least, one more thing by the time this script is perfected.
UPDATE:
I answered my own question, within one half hour after this was posted. After one tiny element was added to the IF condition in this script, it works absolutely beautifully and perfectly as this author intended.
Thank you for your help.
To Weedpacket:
If you had read and understood the original post which is the first part of this post (which is above To Weedpacket), you would not have suggested I use an additional conditional statement. You would have seen that it had already been accomplished.
Do not insult my intelligence with your 5 minutes in the MANUAL.
The SO CALLED MANUAL is nearly useless. Why do you think I had a posted question?
The so called MANUAL is an insult to the connotation of the word MANUAL.
For one thing, there is no context to the layout presented to the user.
Any self respecting MANUAL of instruction will lay out the context for the user at the outset of the MANUAL and adhere to the context of the presentation.
EXAMPLE IS HERE:
The context of a "real" MANUAL uses italics for explanation, i.e. filename. Author's instructional input is presented in italics. What you, the user, should input is presented in bold, and etc for the additional contexts.
IN SHORT THE MANUAL IS NO MANUAL AND IS NEARLY A USELESS DOCUMENT!
I am in the process of looking for the real programming documentation that was created when the language was originally written. When I find it, I'm sure it will prove to be useful information and I will use it as reference to produce A REAL PHP MANUAL.
There should be no reason for so many posts with subjects, "Someone, please help me!". Doesn't that tell you that the so-called MANUALl sucks?
Kill your hyper-inflated ego and get down to earth where the folks are attempting to earnestly and honestly create useful php scripts (and with the proper help will be shortly successful). It is quite obvious to a person of my caliber and experience, by viewing the posts at this site, that your MANUAL sucks!
BTW, forgive any direct reference within this post to your "so-called" MANUAL - if any - that doesn't include the prefix "so-called". Look for a REAL PHP MANUAL in your search paths, sometime in the future.
ALL YOU FOLKS OUT THERE WHO ARE NEEDING TRIED AND TRUE ANSWERS TO YOUR PHP QUESTIONS AND CONCERNS WILL FIND NOTHING BUT TRIED AND TRUE INSTRUCTION TUTORIALS THAT WILL BUILD FROM THE BASIC TO THE COMPLEX PHP SCRIPT. So jot this down someplace where you will be able to refer to it. Sometime in the future, you will do an Internet search for "A real Php Manual" and be able to become an accomplished php script author without the unnecessary frustration, egotistical connotations, and so-called answers to your questions.
Those of you who are interested in having access to a "Real" Php Manual send me an email. I will store your email and reply when a "real" Php Manual is available. This is the email address you should use: 3rrobinson@sbcglobal.net.
I hope you guys will get your sh?t together - or get out of the business of frustrating your visitors and users! BTW, Weedpacket, I welcome an email. If you do not find my email in my profile, here it is: 3rrobinson@sbcglobal.net.
NO THANKS TO OMAHA, THANKS A LOT!
This statement directly to those who create and maintain your "so-called" MANUAL: I sincerely hope that you will view this as a challenge to reproduce your "so-called" MANUAL in a manner in which it will reflect well considered layout and will be built by using third person (manual user being the third person)
communication skills, which BTW, is a horrific downfall of the human race, (no insulting connotations intended to anyone) and communication skill level statistics verify this.
I wish you all true success in your endeavors. Remember, in all communication endeavors, for communication to be successful, you must, to the best of your ability, attempt to determine the level of understanding of the language used and the education level as it applies to the subject. Then expect and respect comebacks such as "Did I understand you to say...?" Then, re-evaluate and adjust your pre-determinations.
Responsibility is NOT a bad word! And it's not necessarily a good word. It can be a negative, as in this instance, when one does not respond according to his abilities. It can be a positive when one responds according to his abilities. Remember to use it in its positive form. Your response will reflect your ability and gain you honor and respect and will inherently enhance your personal growth and value.
Again, with all sincerity, I wish you good luck and good communication!