In this chapter, we’ll look at string and regular expression functions in the context of a
Smart Form Mail application.We’ll add these scripts to the Bob’s Auto Parts site we’ve
been looking at in the last few chapters.
This time, we’ll build a straightforward and commonly used customer feedback form
for Bob’s customers to enter their complaints and compliments, as shown in Figure 4.1.
However, our application will have one improvement over many you will find on the
Web. Instead of emailing the form to a generic email address like feedback@example.
com, we’ll attempt to put some intelligence into the process by searching the input for
96 Chapter 4 String Manipulation and Regular Expressions
key words and phrases and then sending the email to the appropriate employee at Bob’s
company. For example, if the email contains the word “advertising,” we might send the
feedback to the Marketing department. If the email is from Bob’s biggest client, it can go
straight to Bob.
Figure 4.1 Bob’s feedback form asks customers for
their name, email address, and comments.
We’ll start with the simple script shown in Listing 4.1 and add to it as we go along.
Listing 4.1 processfeedback.php—Basic Script to Email Forms Contents
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment