How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1428
Experience:  M.S. in Internet Information Systems
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

Review: Full, Anonymous: No Write a function that validates

Resolved Question:

**For TheDoctor**


Review: Full, Anonymous: No Write a function that validates mailstops for Acme Corp. Valid mailstops consist of a one or two-digit building number, followed by a dash and a single letter. For example, 1-B and 21-C are valid mailstops. 1B, 133-A and 14-AB are not. Your function should accept a string mailstop and return TRUE if the mailstop is valid, and FALSE if it is not. Write your own regular expression for validation. Define an array of mailstops including: 1-B, 21-C, 133-A, and 14-AB. Then, evaluate each mailstop in the array and display a message indicating whether or not each value is valid. Use a loop and your validation function. Your output should look like this (with valid mailstops in green, invalid in red): 1-B is a valid mailstop 21-C is a valid mailstop 133-A is not a valid mailstop 14-AB is not a valid mailstop Now, create a form that allows a user to input a mailstop. The form should submit to itself A submitted mailstop should be fully sanitized (strip white space, remove tags, entitize characters, etc) and lowercase letters should be capatilized automatically When a user enters a mailstop into the form and clicks "Validate Mailstop" (which is the value of the submit button) the input should be sanitized and then run through the validation function. If valid, the output should say bla-bla is a valid mailstop (in green text) or bla-bla is an invalid mailstop (in red text). Next, using PHP (CREATE TABLE IF NOT EXISTS ...) create a table on ned to store your entries (both valid and invalid). Modify your code so that when a user enters a mailstop it is sanitized and then stored in the table (using PDO). Then write a query to select all stored mailstops from the table and display them to the user below the form. So when a user visits your Mailstop Validator form they will see a textbox for input and a "Validate Mailstop" button. Below that they will see a list of previous mailstops entered in red (for invalid mailstops) and green (for valid mailstops). When they enter a mailstop the form will submit to itself, save the mailstop to the database, and display it below the submit button along with the rest as either a valid or invalid mailstop. Make sure you comment out your initial strings and arrays containing mailstops so that they aren't resubmitted to the database everytime someone visits the page. Only store the actual mailstop in the database (both working and unworking). Don't store the "is a valid mailstop" or the "is not a valid mailstop". Use your function to append the appropriate message, and make sure your function is also supplying the proper css to make each mailstop red or green (using a span tag with a class of green or red).

Submitted: 1 year ago.
Category: Homework
Expert:  TheDoctor replied 1 year ago.

Hello again! Thank you for requesting me.

I will contact you once this is complete.

Thank you

Customer: replied 1 year ago.

Thanks Doc!!

Customer: replied 1 year ago.

HI Doc,


Do you think you can have this done by 11:30PM?

Expert:  TheDoctor replied 1 year ago.
Hello again,

What time zone is that (What time is it where you are)?
Customer: replied 1 year ago.

PST

Expert:  TheDoctor replied 1 year ago.
I can have it to you before 11:30PM PDT.
Customer: replied 1 year ago.

OK PDT

Expert:  TheDoctor replied 1 year ago.
Hello again!

Please download the file here:

Attachment: 2013-06-11_045556_mailstop.zip



Before you can run the file, you must make certain that it is connecting to the database correctly.

Look at lines 4, 5, and 6 of the code. These define your connection parameters. You can see that right now, I am connecting to a database on localhost called mailstop

I am using the username root and no password.

Change these to match your system so that it can connect to your database. Also, make certain that the database you are connecting to exists. If you decide to keep it as mailstop, make sure you create that database. Otherwise, change mailstop to an actual database that you are using.

The page itself creates the table upon first load, as per the instructions.

You can then start entering mailstops. Valid ones will display in green and invalid ones will display in red underneath the form. The mailstops are all saved to the database.

Let me know if you have any questions. I'm here to help.

Please remember to rate my answer. Thank you so much and have a wonderful night!
Customer: replied 1 year ago.

I don't see the array


Define an array of mailstops including: 1-B, 21-C, 133-A, and 14-AB. Then, evaluate each mailstop in the array and display a message indicating whether or not each value is valid. Use a loop and your validation function. Your output should look like this (with valid mailstops in green, invalid in red)

Expert:  TheDoctor replied 1 year ago.
Sorry, I accidentally deleted it.

It is commented out code. As per the instructions, it is to be commented out. The database code takes the place of the array and its loop. Here is the file with the commented out code:

Attachment: 2013-06-11_052125_mailstop2.zip



You can see it on lines 33 - 39.

Let me know if you have any other questions.

Please remember to rate my answer. Thank you again.
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1428
Experience: M.S. in Internet Information Systems
TheDoctor and 10 other Homework Specialists are ready to help you
Expert:  TheDoctor replied 1 year ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
Customer: replied 1 year ago.

Thanks Doc for your help

Expert:  TheDoctor replied 1 year ago.
You are very welcome.

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Last | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX
 
 
 

Meet The Experts:

 
 
 
  • Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
< Last | Next >
  • http://ww2.justanswer.com/uploads/BU/BusinessTutor/2012-2-2_115741_Kouki2.64x64.jpg Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany

    Tutor

    Satisfied Customers:

    4520
    More than 5000 online tutoring sessions.
  • http://ww2.justanswer.com/uploads/LI/lindaus/2012-6-10_04811_IMG20120609164157.64x64.jpg Linda_us's Avatar

    Linda_us

    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    3121
    Post Graduate Diploma in Management (MBA)
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Engineer

    Satisfied Customers:

    3035
    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • http://ww2.justanswer.com/uploads/lanis/2009-4-1_233717_phput9xef_c1pm.jpg Lani S.'s Avatar

    Lani S.

    Tutor

    Satisfied Customers:

    2457
    Registered Nurse, Internet Researcher, Private Tutor
  • http://ww2.justanswer.com/uploads/chooser77/2009-08-18_162025_Chris.jpg Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    2341
    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • http://ww2.justanswer.com/uploads/JawaadAhmed/2009-6-27_12137_SIs_SHadi.jpg F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    1975
    Experience with chartered accountancy
  • http://ww2.justanswer.com/uploads/JK/jkcpa/2011-1-16_182614_jkcpa.64x64.jpg Bizhelp's Avatar

    Bizhelp

    CPA

    Satisfied Customers:

    1873
    Bachelors Degree and CPA with Accounting work experience