Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member weblebowski's Avatar
    Join Date
    Mar 2012
    Posts
    19
    Member #
    31067
    Liked
    1 times
    Recently started learning PHP and have not really gotten to MySQL at all yet. One question...

    Would it be relatively easy to set up a form for users to input song lyrics and then to have the lyrics hosted on the site afterwards? How would I accomplish this exactly? I'm assuming it could be done with a little PHP/MySQL?

  2.  

  3. #2
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    92 times
    This would only require the most basic use of PHP and MySQL. It depends how complex you need it to be to be honest!
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)

  4. #3
    Junior Member weblebowski's Avatar
    Join Date
    Mar 2012
    Posts
    19
    Member #
    31067
    Liked
    1 times
    Yeah, I figured. I have a pretty good idea of how the PHP would work. It wouldn't be too complex--I would just add appropriate HTML markup and styles to the lyrics through the PHP. I guess I simply need to figure out how to set up the MySQL side of things....

  5. #4
    Junior Member weblebowski's Avatar
    Join Date
    Mar 2012
    Posts
    19
    Member #
    31067
    Liked
    1 times
    Also: How do I echo the contents of a textbox and insert line breaks at the end of each line?

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Song lyrics for existing songs?

    You probably realize that there are online databases already available with thousands of song lyrics.
    Not sure if you were doing lyrics for your own song creations, or existing songs from every genre.


  7. #6
    Senior Member Ganners's Avatar
    Join Date
    Feb 2011
    Location
    United Kingdom
    Posts
    415
    Member #
    27007
    Liked
    92 times
    Quote Originally Posted by weblebowski, post: 232513
    Also: How do I echo the contents of a textbox and insert line breaks at the end of each line?
    You should just try it out. Here's an example if you put these two files in the same location this will work:

    index.php:
    PHP Code:
    <?php
    class Main {

        
    /**
        * Constructs the test application
        * @param nil
        * @return void
        */

        
    public function __construct() {

            if(isset(
    $_POST['text'])) {
                
    $this->printText($_POST['text']);
            }
            else {
                
    $this->printTextarea();
            }

        }

        
    /**
        * Prints the text with nl2br
        */

        
    private function printText($text) {
            echo 
    nl2br($text);
        }

        
    /**
        * Prints out the file containing the textarea
        */

        
    private function printTextarea() {
            echo 
    file_get_contents("form.php");
        }

    }

    new 
    Main();
    form.php:
    PHP Code:
    <!doctype html>
    <
    html>
        <
    head>
            <
    title>nl2br test</title>
            <
    style type="text/css">
            </
    style>
        </
    head>
        <
    body>
            <
    form method="POST">
                <
    textarea id="text" name="text"></textarea>
                <
    input type="submit">
            </
    form>
        </
    body>
    </
    html
    Mark Gannaway Software Developer

    Recent Experiments
    - Backpropogation Neural Network language solving (http://ann.ganners.co.uk/)
    - Animated image to ASCII (http://google.ganners.co.uk/)
    - 3D Paper Characters (http://cybergame.ganners.co.uk/)
    - Anagram solving (http://roflol.co.uk/)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:03 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com