{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-09-24T12:11:36-04:00", "answer_date": "2024-09-24 12:11:36", "is_docs_available": "", "is_excel_available": "", "is_pdf_available": "", "count_file_available": 0, "main_page": "student_question_view", "question_id": "13016225", "url": "\/study-help\/questions\/in-this-assignment-you-will-create-a-script-that-validates-13016225", "question_creation_date_js": "2024-09-24T12:11:36-04:00", "question_creation_date": "Sep 24, 2024 12:11 PM", "meta_title": "[Solved] In this assignment, you will create a scr | SolutionInn", "meta_description": "Answer of - In this assignment, you will create a script that validates whether a credit card number contains only integers. The s | SolutionInn", "meta_keywords": "assignment,will,create,script,validates,credit,card,number,integers,remove,dashes,spaces", "question_title_h1": "In this assignment, you will create a script that validates whether a credit card number contains only integers. The script will remove dashes and spaces", "question_title": "In this assignment, you will create a script that validates whether a", "question_title_for_js_snippet": "In this assignment, you will create a script that validates whether a credit card number contains only integers The script will remove dashes and spaces from the string After the dashes and spaces are removed, the script should reject the credit card number if it contains any other non numeric characters Useful built in PHP functions empty()(Links to an external site )Links to an external site ,str replace()(Links to an external site )Links to an external site ,is numeric()(Links to an external site )Links to an external site 1 Create a new phpfile named ValidateCreditCard php in yourIDE 2 Type declaration, element, document head, and element The page should be Validate Credit Card Validate Credit Card 3 Add the following text and elements to the document body Validate Credit Card 4 Add the following script section to the document body ", "question_description": "

In this assignment, you will create a script that validates whether a credit card number contains only integers. The script will remove dashes and spaces from the string. After the dashes and spaces are removed, the script should reject the credit card number if it contains any other non-numeric characters.<\/p>

Useful built-in PHP functions:empty()(Links to an external site.)Links to an external site.,str_replace()(Links to an external site.)Links to an external site.,is_numeric()(Links to an external site.)Links to an external site. <\/p> <\/div>

<\/p>

1. Create a new phpfile named ValidateCreditCard.php in yourIDE. <\/p> <\/div>

<\/p>

2. Type declaration, element, document head, and element. The page should be Validate Credit Card. <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><!DOCTYPE html> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><html> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><head> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><title>Validate Credit Card<\/title> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><\/head> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><body> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><\/body> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><\/html> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">3. Add the following text and elements to the document body: <h1>Validate Credit Card<\/h1><hr \/> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">4. Add the following script section to the document body: <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"><?php <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" style=\"font-family: 'Helvetica Neue',Helvetica,Arial; color:#333333;\" id=\"mobile-question-style\"> <p dir=\"ltr\">\/\/ADD CODE HERE <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" style=\"font-family: 'Helvetica Neue',Helvetica,Arial; color:#333333;\" id=\"mobile-question-style\"> <p dir=\"ltr\">?> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">5. Declare a $CreditCard array that contains three values: an empty string, a valid credit card number with numbers and dashes, and a credit card number with four initial uppercase letter Os. <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">$CreditCard = array( \"\", \"8910-1234-5678-6543\", \"OOOO-9123-4567-0123\"); <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">6. Add the following statements to iterate through each of the elements in the $CreditCard array to determine if the element contains a value. <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">foreach ($CreditCard as $CardNumber) { <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">if (empty($CardNumber)) { <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">echo \"<p>This Credit Card Number is invalid because it contains an empty string.<\/p>\"; <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">} <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">7. In the else clause validate the credit card number. The functionstr_replace()(Links to an external site.)Links to an external site.can be used to remove any dashes and spaces in the number. Then, use a nested if...else statement to checks whether the new value is numeric using theis_numeric()(Links to an external site.)Links to an external site.function of if the string isempty().(Links to an external site.)Links to an external site.If the number is not numeric, a warning is displayed. If the number is numeric, the modified credit card number is displayed in the Web browser. <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">else { <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\"> <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">\/\/ADD CODE HERE <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">} <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">8. Save the script as ValidateCreditCard.php and upload the file to the server module4b directory. <\/p> <\/div> <p dir=\"ltr\"> <\/p> <div align=\"left\" id=\"mobile-question-style\"> <p dir=\"ltr\">9. Open ValidateCreditCard.php in your local XAMPP Web browser by entering the following URL: ValidateCreditCard.php. Test the script to see if it displays a message for an empty string, strips dashes and spaces from the credit card numbers, and identifies which credit card numbers are valid.<\/p> <\/div>", "transcribed_text": "", "related_book": { "title": "SQL Instant Reference", "isbn": "0782125395, 9780782125399", "edition": "2nd Edition", "authors": "Gruber, Martin Gruber", "cover_image": "https:\/\/dsd5zvtm8ll6.cloudfront.net\/si.question.images\/book_images\/2022\/02\/61fa21abd7eda_57161fa21ab58915.jpg", "uri": "\/textbooks\/sql-instant-reference-2nd-edition-9780782125399", "see_more_uri": "\/textbooks\/computer-science-zendesk-2782" }, "question_posted": "2024-09-24 12:11:36", "step_by_step_answer": "The Answer is in the image, click to view ...", "students_also_viewed": [ { "url": "\/study-help\/business-communication-essentials\/recount-the-fundamental-assumptions-of-the-nonverbal-expectancy-violations-theory-2104676", "description": "Recount the fundamental assumptions of the nonverbal expectancy violations theory", "stars": 0 }, { "url": "\/reco-corp-is-expected-to-pay-a-dividend-of-225", "description": "Reco Corp. is expected to pay a dividend of $2.25 next year. The forecast for the stock price a year from now is $37.50. If the required rate of return is 14 percent, what is the current stock price?...", "stars": 3 }, { "url": "\/study-help\/questions\/in-this-assignment-you-will-create-a-script-that-validates-13016225", "description": "In this assignment, you will create a script that validates whether a credit card number contains only integers. The script will remove dashes and spaces from the string. After the dashes and spaces...", "stars": 3 }, { "url": "\/study-help\/questions\/harrison-corporation-is-interested-in-acquiring-van-buren-corporation-assume-12297509", "description": "Harrison Corporation is interested in acquiring Van Buren Corporation. Assume that the risk-free rate of interest is 6% and the market risk premium is 5%. Van Buren currently expects to pay a...", "stars": 3 }, { "url": "\/study-help\/questions\/one-of-your-colleagues-is-planning-on-changing-ie-altering-5477646", "description": "One of your colleagues is planning on changing (ie. altering the numbers) his collected data to make the data \"say\" what he wants the data to state. His plan is to submit the abstract to a national...", "stars": 3 }, { "url": "\/study-help\/questions\/assume-food-delivery-firms-like-swiggy-are-making-huge-profits-5074733", "description": "Assume food delivery firms like Swiggy are making huge profits. Higher profits may attract the entry of new firms into the food delivery industry. Explain what could be the impact of entry on the...", "stars": 3 }, { "url": "\/study-help\/questions\/this-problem-has-such-a-simple-solution-why-are-we-5081724", "description": "\"This problem has such a simple solution. Why are we spending so much time discussing this? I could have been finishing my work instead of wasting my time here,\" thought Lamar while attending a...", "stars": 3 }, { "url": "\/study-help\/questions\/hi-i-need-help-with-these-two-questions-please-i-5086823", "description": "Time Dilation: An astronaut travels at a speed of 0.95c away from Earth. The astronaut sends a light signal back to Earth every 1.0 s, as measured by her clock. An observer on Earth notes that these...", "stars": 3 }, { "url": "\/study-help\/questions\/suppose-cocacola-and-pepsicola-who-do-not-communicate-are-engaged-5088952", "description": "Suppose Coca-Cola and Pepsi-Cola, who do not communicate, are engaged in a sales game and each firm seeks to maximize profit. The firms set high price or low price. If both set high price, each makes...", "stars": 3 }, { "url": "\/study-help\/managing-human-behavior-in-public\/have-roles-been-defined-and-assigned-2124873", "description": "Have roles been defined and assigned?", "stars": 3 }, { "url": "\/study-help\/managing-human-behavior-in-public\/are-these-written-ground-rules-2124868", "description": "Are these written ground rules?", "stars": 3 }, { "url": "\/study-help\/managing-human-behavior-in-public\/how-do-members-envision-the-ideal-team-2124865", "description": "How do members envision the ideal team?", "stars": 3 } ], "next_back_navigation": { "previous": "\/study-help\/questions\/o-netstat-d-question-6-1-pts-mouse-gestures-are-13016224", "next": "\/study-help\/questions\/i-need-help-getting-a-program-that-would-give-me-13016226" }, "breadcrumbs": [ { "name": "Study help", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers" }, { "name": "Computer Science", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers\/computer-science" }, { "name": "Databases", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/computer-science-databases" }, { "name": "In this assignment, you will create a script that validates whether a", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/in-this-assignment-you-will-create-a-script-that-validates-13016225" } ], "skill_details": { "skill_id": "656", "skill_name": "Databases", "parent_id": "8" } }