Question: - PHP Assignment help - PHP Programming with my SQL # 2 - Please include proper comments for both php and html files and use

- PHP Assignment help - PHP Programming with my SQL # 2

- Please include proper comments for both php and html files and use proper indentation. If you are not sure how to do the assignment, pleaseeeeeeee skip!

Create a Song Organizer script that stores songs in a text file. Include functionality that allows users to view the song list and prevents the same song name from being entered twice. Also, include code that sorts the songs by name, deletes duplicate entries, and randomizes the song list with the shuffle() function.

  1. Create a new document in your text editor.

  2. Type the declaration, element, header information, and element. Use the strict DTD and Song Organizer as the content of the element.</p> </li> <li> <p>Add the following XHTML code and script section to the document body:</p> <pre> <h1>Song Organizer</h1> <?php ?> </pre> </li> </ol> <p>4. Add the following code to the script section to handle any</p> <p>parameters in the URL:</p> <pre> if (isset($_GET['action'])) { if ((file_exists("SongOrganizer/songs.txt")) </pre> <pre>&& (filesize("SongOrganizer/songs.txt") != 0)) { $SongArray = file( </pre> <pre> "SongOrganizer/songs.txt"); switch ($_GET['action']) { } // End of the switch statement </pre> <table style="border-collapse:collapse;" cellspacing="0"> <tbody> <tr> <td style="background-color:rgb(30%,30%,30%);"> </td> <td> <p><strong>370</strong></p> </td> </tr> </tbody> </table> <p>} }</p> <ol start="5"> <li> <p>Add the following code to the body of the switch statement to handle the three options (Sort Ascending, Remove Duplicates, and Shuffle):</p> <pre> case 'Remove Duplicates': $SongArray = array_unique( </pre> <pre> $SongArray); $SongArray = array_values( </pre> <pre> $SongArray); break; </pre> <pre> case 'Sort Ascending': sort($SongArray); </pre> <pre> break; case 'Shuffle': </pre> <pre> shuffle($SongArray); break; </pre> </li> <li> <p>Add the following code immediately after the switch state- ment to save the song list after it has been modified:</p> <pre> if (count($SongArray)>0) { $NewSongs = implode($SongArray); $SongStore = fopen( </pre> <pre> "SongOrganizer/songs.txt", </pre> <pre> "wb"); if ($SongStore === false) </pre> <pre> echo "There was an error updating the song file "; </pre> <pre> else { fwrite($SongStore, $NewSongs); fclose($SongStore); </pre> <p>} }</p> <pre> else unlink("SongOrganizer/songs.txt"); </pre> </li> </ol> <p>7. Add the following code to the end of the script section to handle any data submitted from the Web form:</p> <pre> if (isset($_POST['submit'])) { $SongToAdd = stripslashes( </pre> <pre> $_POST['SongName']) . " "; $ExistingSongs = array(); if (file_exists("SongOrganizer/songs.txt") </pre> <p>} }</p> <pre>&& filesize("SongOrganizer/songs.txt") > 0) { $ExistingSongs = file( </pre> <pre> "SongOrganizer/songs.txt"); </pre> <ol start="8"> <li> <p>Add the following if statement immediately after the block where the song file data was read into the $ExistingSongs array. This if statement checks to see if the song name entered is already in the song list, and displays a message if the song already exists.</p> <pre> if (in_array($SongToAdd, $ExistingSongs)) { echo "<p>The song you entered already </pre> <pre> exists!<br /> "; echo "Your song was not added to the </pre> <p>list.</p>";</p> </li> <li> <p>Add the following else clause to the preceding if statement.</p> <p>This else clause adds the new song to the song list file.</p> <pre> else { $SongFile = fopen( </pre> <pre> "SongOrganizer/songs.txt", "ab"); if ($SongFile === false) </pre> <pre> echo "There was an error saving your message! "; </pre> <pre> else { fwrite($SongFile, $SongToAdd); fclose($SongFile); echo "Your song has been added to </pre> <pre> the list. "; </pre> <p>} }</p> </li> <li> <p>Add the following code to the end of the script section to dis- play the song list, or a message that there are no songs in the list if the list is empty:</p> <pre> if ((!file_exists("SongOrganizer/songs.txt")) || (filesize("SongOrganizer/songs.txt") == 0)) echo "<p>There are no songs in the </pre> <pre> list.</p> "; </pre> <pre> else { $SongArray = file( </pre> <pre> "SongOrganizer/songs.txt"); echo "<table border=\"1\" width=\"100%\" </pre> <pre> style=\"background-color:lightgray\"> "; foreach ($SongArray as $Song) { </pre> <pre> echo "<tr> "; echo "<td>" . htmlentities($Song) . </pre> <pre> "</td>"; echo "</tr> "; </pre> <p>}</p> <pre> echo "</table> "; } </pre> </li> <li> <p>Add the following XHTML code immediately after the PHP script section to display hyperlinks for the three functions in the switch statement (Sort Ascending, Remove Duplicates, and Shuffle):</p> <pre> <p> </pre> <p>Sort Song List<br /> </p> <pre> Remove Duplicate Songs<br /> </pre> <pre> Randomize Song list<br /> </p> </pre> </li> <li> <p>Next, add the following XHTML code to create a Web form for entering new song names into the song list:</p> <pre> <form action="SongOrganizer.php" method="post"> <p>Add a New Song</p> <p>Song Name: <input type="text" name="SongName" </pre> <pre> /></p> <p><input type="submit" name="submit" </pre> <pre> value="Add Song to List" /> <input type="reset" name="reset" </pre> <pre> value="Reset Song Name" /></p> </form> </pre> </li> <li> <p>Save the document as <strong>SongOrganizer.php</strong> in the Projects directory for Chapter 6 and upload the file to the server.</p> </li> <li> <p>Open the SongOrganizer.php file in your Web browser by entering the following URL: <em>http://<yourserver>/PHP_ Projects/Chapter.06/Projects/SongOrganizer.php</em>.</p> </li> <li> <p>Close your Web browser window.</p> </li> </ol> </div> <div class="question-answer-divider"></div> <section class="answerHolder" itemscope itemtype="http://schema.org/Answer"> <div class="answerHolderHeader"> <h2>Step by Step Solution</h2> <div class="answerReviews"> <div class="starIcon"> </div> </div> </div> <div class="questionProperties"> <p>There are 3 Steps involved in it</p> <div class="cart-flex"> <div class="cart cart1"> 1 Expert Approved Answer </div> </div> </div> <div class="step org_answer"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="step-heading step-1">Step: 1 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> <img src="https://www.solutioninn.com/includes/images/document_product_info/blur-text-image.webp" class="blured-ans-image" width="759" height="271" alt="blur-text-image" decoding="async" fetchpriority="high"> <div class="step1Popup"> <span class="heading">Question Has Been Solved by an Expert!</span> <p>Get step-by-step solutions from verified subject matter experts</p> <button class="view_solution_btn step1PopupButton">View Solution</button> </div> </div> <div class="step"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="accordion step-heading">Step: 2 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> </div> <div class="step"> <span class="view_solution_btn view-solution-btn-cursor"> <strong class="accordion step-heading">Step: 3 <span>Unlock <i class="fa-solid fa-lock"></i></span></strong> </span> </div> </section> <section class="relatedQuestion"> <h3>Students Have Also Explored These Related Databases Questions!</h3> <div class="relatedQuestionSliderHolder"> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/objectives-more-familiar-with-php-syntax-use-objectoriented-code-to-13468013" > Objectives: More familiar with PHP Syntax Use object-oriented code to structure concepts Read from API Transform raw data into objects you can interact with Interact with a collection of objects for... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/ill-give-you-5-stars-for-your-help-please-provide-9603029" > ILL GIVE YOU 5 STARS FOR YOUR HELP. (Please provide comments on each step so I know whats going on. thank you ) Programming Assignment #1 "Polynomials Using the ArrayList Class" The Term Class Create... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/can-you-please-correct-the-errors-include-include-using-namespace-12726759" > Can you please correct the errors! #include #include using namespace std; //declaring variables char recommendedpackage, answer; string packagedetails, fname; double additionaldata, monthlypayment,... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/problem-1-your-boss-has-asked-you-to-create-a-13485849" > Problem 1 Your boss has asked you to create a template for the new web site. Learning Outcomes Demonstrate creativity and problem-solving skills. Analyze web programs in order to test, debug, and... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/hello-im-new-to-php-and-the-professor-i-have-9226061" > Hello, I'm new to php and the professor i have isnt good at teaching the class. I'm wondering if anyone can help me with the following problem. I created the entire html but i dont understand how to... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/hello-can-anyone-help-me-with-this-problem-im-not-7754263" > Hello, can anyone help me with this problem. I'm not quite sure how to do this at all. Objectives: To acquaint you with PHP file handling, HTML forms, arrays, strings, and control structures Tasks:... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/task-you-are-to-create-a-forum-website-based-on-730848" > TASK You are to create a forum website based on the descriptions below, that allows users to sign up and create topics and posts on those topics. SET-UP Create a folder on... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/please-do-lab-on-linux-terminal-and-use-gedit-as-12706346" > Please do lab on linux terminal and use gedit as editor and zoom in for better vision Please zoom in for better vision CPSC 1110 Fall 2020, Programming Assignment 1: Sum of Digits Due 11:59:59 pm on... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/part-1-planning-d-introduction-planning-for-a-project-is-4400805" > Part 1: Planning D Introduction Planning for a project is an important skill, so the TT284 EMA includes an element to encourage you to think about the work you will have to complete, how long the... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/algorithm-analysis-objective-code-in-c-the-objective-of-this-12599039" > Algorithm Analysis Objective CODE IN C++ The objective of this programming assignment is to present the student with a C++ introduction assignment with a more challenging problem to solve than the... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/arrange-the-following-in-increasing-order-of-their-basic-strength-454232" > Arrange the following in increasing order of their basic strength: (i) C.H.NH,, C.H.NH,, NH,, C.H.CH,NH, and (CH)NH (ii) C.H.NH,, (C.H.).NH, (C.H.).N, C.H.NH. (ii) CHNH, (CH,),NH, (CH)N, CHNH,... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/the-bartlett-method-is-used-to-estimate-the-power-spectrum-of" > The Bartlett method is used to estimate the power spectrum of a signal from a sequence x(n) consisting of N = 2400 samples. (a) Determine the smallest length M of each segment in the Bartlett method... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/what-will-happen-to-the-internal-rate-of-return-27937808" > What will happen to the internal rate of return ( IRR ) of a project if the discount rate is decreased from 9 % to 7 % ? Question content area bottom Part 1 A . IRR will always increase. B . The... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/questions/andrea-apple-opened-apple-photography-on-january-1-of-the-15479964" > Andrea Apple opened Apple Photography on January 1 of the current year. During January, the following transactions occurred and were recorded in the company's books: Andrea invested $15,500 cash in... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/international-human-resource-management/4-job-analysis-enables-human-resource-professionals-and-operating-managers-2124454" > 4. Job analysis enables human resource professionals and operating managers to identify the proper tasks, duties, and responsibilities of various organizational jobs. Given its importance, the... </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/international-human-resource-management/lo1-explain-how-the-workforce-is-changing-in-unpredicted-ways-2124445" > LO1 Explain how the workforce is changing in unpredicted ways. </a> </div> <div class="relatedQuestionCart "> <p class="heading">Q: </p> <a class="relatedQuestionText" href="/study-help/international-human-resource-management/lo6-list-the-components-of-job-descriptions-2124450" > LO6 List the components of job descriptions. </a> </div> </div> <nav class="navigationButtons"> <a class="previousQuestionButton" href="/study-help/questions/which-statement-accurately-analyzes-the-design-principle-evident-in-this-13015457">Previous Question</a> <a class="nextQuestionButton" href="/study-help/questions/please-use-the-following-numbers-to-demonstrate-how-diffie-hellman-13015459">Next Question</a> </nav> </section> </main> <aside class="expertRight"> <section class="relatedBook" style="margin-bottom:40px; width: 100%;" > <div class="bookHolder" > <div class="relatedBookHeading" > <h2 class="heading">Recommended Textbook</h2> </div> <div class="bookMainInfo" > <div class="bookImage" style="width: 100px !important; min-width: 100px; flex-shrink: 0; margin-right: 20px;"> <a href="/textbooks/professional-sql-server-2012-internals-and-troubleshooting-1st-edition-9781118177655"> <img src="https://dsd5zvtm8ll6.cloudfront.net/si.question.images/book_images/2022/02/61fa21aae39ba_57061fa21aa4e463.jpg" width="100" height="131" alt="Professional SQL Server 2012 Internals And Troubleshooting" loading="lazy" style="width: 100px !important;"> </a> <a href="/textbooks/computer-science-while-loops-2484" style="margin-top: 8px; display: block; text-align: left;">More Books</a> </div> <div class="bookInfo" style="text-align: left;"> <span class="bookTitle" style="text-align: left;"> <a href="/textbooks/professional-sql-server-2012-internals-and-troubleshooting-1st-edition-9781118177655" style="text-align: left;"> Professional SQL Server 2012 Internals And Troubleshooting </a> </span> <div class="bookMetaInfo" style="text-align: left;"> <p class="bookAuthor" style="text-align: left;"> <b>Authors:</b> <span>Christian Bolton, Justin Langford</span> </p> <p class="bookEdition" style="text-align: left;"> 1st Edition </p> <p class="bookEdition" style="text-align: left;"> 1118177657, 9781118177655 </p> </div></div></div> </div> </section> <div class="post-question-section"> <div class="description-question-section"> <span class="post-question-section-title">Ask a Question and Get Instant Help!</span> </div> <div class="text-area-post-question"> <form action="/study-help/post-question?ref=search" method="post" enctype="multipart/form-data"> <textarea rows="4" class="form-control form-posting-margin" name="textarea-question-content" id="textarea-question-content" placeholder="Type Your Question ...."></textarea> <button type="submit" class="btn btn-sm btn-submit-post-question text-center">Get Answer</button> </form> </div> </div> </aside> </div> </div> <div class="promo items-center justify-center hidden"> <div class="app_promo"> <span class="app_promo_dismiss"> <i class="fa-solid fa-x"></i> </span> <div class="app-button"> <div class="image-wrapper"> <img width="30" height="30" src="https://www.solutioninn.com/includes/images/rewamp/common/mobile-app-logo.png" decoding="async" fetchpriority="high" alt="SolutionInn App Logo"> <strong>Study Help</strong> </div> <button class="app_promo_action redirection" data-question-open-url='q_id=13015458&q_type=2'> Open in App </button> </div> </div> </div> </div> </div> <div class="blank-portion"></div> <footer> <div class="container footerHolder"> <div class="footerLinksFlex"> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Services</p> <ul> <li><a href="/site-map">Sitemap</a></li> <li><a href="/fun/">Fun</a></li> <li><a href="/study-help/definitions">Definitions</a></li> <li><a href="/tutors/become-a-tutor">Become Tutor</a></li> <li><a href="/books/used-textbooks">Used Textbooks</a></li> <li><a href="/study-help/categories">Study Help Categories</a></li> <li><a href="/study-help/latest-questions">Recent Questions</a></li> <li><a href="/study-help/questions-and-answers">Expert Questions</a></li> <li><a href="/clothing">Campus Wear</a></li> <li><a href="/sell-books">Sell Your Books</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Company Info</p> <ul> <li><a href="/security">Security</a></li> <li><a href="/copyrights">Copyrights</a></li> <li><a href="/privacy">Privacy Policy</a></li> <li><a href="/conditions">Terms & Conditions</a></li> <li><a href="/solutioninn-fee">SolutionInn Fee</a></li> <li><a href="/scholarships">Scholarship</a></li> <li><a href="/online-quiz">Online Quiz</a></li> <li><a href="/study-feedback">Give Feedback, Get Rewards</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-6"> <p>Get In Touch</p> <ul> <li><a href="/about-us">About Us</a></li> <li><a href="/support">Contact Us</a></li> <li><a href="/career">Career</a></li> <li><a href="/jobs">Jobs</a></li> <li><a href="/support">FAQ</a></li> <li><a href="https://www.studentbeans.com/en-us/us/beansid-connect/hosted/solutioninn" target="_blank" rel="noopener nofollow">Student Discount</a></li> <li><a href="/campus-ambassador-program">Campus Ambassador</a></li> </ul> </div> <div class="footerLinksCol col-md-3 col-lg-3 col-sm-6 col-12"> <p>Secure Payment</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder"> <img src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/common/footer/secure_payment_method.png" class="img-fluid mb-3" width="243" height="28" alt="payment-verified-icon" loading="lazy"> </div> </div> <p>Download Our App</p> <div class="footerAppDownloadRow"> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="1"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/google-play-svg.svg" alt="SolutionInn - Study Help App for Android" width="116" height="40" class="img-fluid mb-3 " loading="lazy"> </div> <div class="downloadLinkHolder mobileAppDownload col-md-6 col-lg-6 col-sm-6 col-6 redirection" data-id="2"> <img style="cursor:pointer;" src="https://dsd5zvtm8ll6.cloudfront.net/includes/images/rewamp/home_page/apple-store-download-icon.svg" alt="SolutionInn - Study Help App for iOS" width="116" height="40" class="img-fluid mb-3" loading="lazy"> </div> </div> </div> </div> </div> <div class="footer-bottom"> <p>© 2026 SolutionInn. All Rights Reserved</p> </div></footer> <script> window.addEventListener("load",function(){jQuery(document).ready(function(t){ // Clarity tracking (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "sjv6tuxsok"); // Helper to read a cookie by name function getCookie(name) { return document.cookie .split('; ') .map(v => v.split('=')) .reduce((acc, [k, val]) => (k === name ? decodeURIComponent(val || '') : acc), ''); } // Read cookies var si = getCookie('si_u_id'); var uid = getCookie('u_id'); var zen = getCookie('zenid'); // Send to Clarity if (si) clarity('set', 'si_u_id', si); if (uid) clarity('set', 'u_id', uid); if (zen) clarity('set', 'zenid', zen); clarity('set', 'ip_address', '216.73.216.134'); t.ajax({type:"POST",url:"/",data:{trackUserActivity:!0,reqUri:document.URL,referer:document.referrer},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(t){t.ajax({type:"POST",url:"/",data:{insertCrawler:!0,reqUri:document.URL,parseTime:"0.056",queryTime:"0.01654768548584",queryCount:"30"},success:function(t){}})})},!1),window.addEventListener("load",function(){jQuery(document).ready(function(){function t(t="",n=!1){var i="itms-apps://itunes.apple.com/app/id6462455425",e="openApp://action?"+t;isAndroid()?(setTimeout(function(){return window.location="market://details?id=com.solutioninn.studyhelp",!1},25),window.location=e):isIOS()?(setTimeout(function(){return window.location=i,!1},25),window.location=e):(i="https://apps.apple.com/in/app/id6462455425",n&&(i="https://play.google.com/store/apps/details?id=com.solutioninn.studyhelp"),window.open("about:blank","_blank").location.href=i)}jQuery("#appModal").modal("show"),jQuery(".download-app-btn").click(function(){t(jQuery(this).attr("data-question-open-url"))}),jQuery(".redirection").click(function(){var n=jQuery(this).attr("data-question-open-url"),i=jQuery(this).attr("data-id");void 0!=n?1==i?t(n,!0):t(n,!1):1==i?t("",!0):t("",!1)}),jQuery(".app-notification-close").click(function(){jQuery(".app-notification-section").css("visibility","hidden");var t=new FormData;t.append("hide_notification",!0),jQuery.ajax({type:"POST",url:"/",data:t,cache:!1,contentType:!1,processData:!1,beforeSend:function(){},success:function(t){location.reload()}})})})},!1); </script> </body> </html>