Results 1 to 7 of 7

Thread: Form Data Submission to Scrolling Marquee

  1. #1
    Join Date
    May 2012
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Form Data Submission to Scrolling Marquee

    Help! I need script that allows data submitted in a form on one page, to appear in a scrolling marquee on another. Please include links for any necessary
    CSS or JQuery.

    Thanks!

  2. #2
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,510
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    1.html

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <form action="2.html" method="get">
    <input type="text" name="userInput1">
    <input type="submit">
    </form>
    </body>
    </html>
    2.html

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <marquee><div id="div1"></div></marquee>
    <script>
      var query = window.location.search;
      if (query.substring(0, 1) == '?') {
        query = query.substring(1);
      }
      var data = query.substring(11);
    document.getElementById('div1').innerHTML = data;
    </script>
    </body>
    </html>

  3. The Following User Says Thank You to keyboard For This Useful Post:

    JBest (05-08-2012)

  4. #3
    Join Date
    May 2012
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy

    Thanks so much, forgive me, I am new at this. I created the two html pages. Where do I put the php code? I need to be more specific as well. I want the data submitted in the form on this page (see below) to appear on another page in a vertically scrolling marquee, adding each name to the list once submitted.

    http://godsmasterdesign.org/EcoPower/Earnings.cgi (I'm going to change it to a html page with no captha code)
    Last edited by JBest; 05-08-2012 at 08:53 AM. Reason: Clarifying reply

  5. #4
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,510
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    This doesn't use any php. It's just javascript.
    I didn't realise you had access to php. If you want, just say so and I'll do this in php.

    Why would you have .cgi pages, but be using php? The file extension for php is .php (or are you swapping from one to the other?). If you want the list to be updated, you're going to need a database (Mysql is good) to store the values. Does your webhost support php/mysql?

  6. The Following User Says Thank You to keyboard For This Useful Post:

    JBest (05-08-2012)

  7. #5
    Join Date
    May 2012
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Yes! My web host supports php/mysql. Yes Please do it for me in php. Thanks!

  8. #6
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,510
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    1.php

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <form action="2.php" method="post">
    <input type="text" name="userInput1" />
    <input type="submit" name="submit1" />
    </form>
    </body>
    </html>
    2.php

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <?php
    mysql_connect("localhost", "username", "password") or die(mysql_error());
    mysql_select_db("dbName") or die(mysql_error());
    if(isset($_POST['submit1'])) {
    	$maxChars = 100; // Put the maximum number of characters you want them to be able to enter here.
    	$userInput = mysql_real_escape_string($_POST['userInput1']);
    	$userInput = substr($userInput, $maxChars);  // This the maximum number of characters that a user can submit. Anything after this is simply dropped from their submission
    	$timeObject = time();
    	$ip = $_SERVER['REMOTE_ADDR'];
    	mysql_query("INSERT INTO userPosts (id, post, timeObject, ip) VALUES('0', '$userInput', '$timeObject', '$ip') ");  
    	$result = mysql_query("SELECT * FROM userPosts ORDER BY timeObject");  
    	echo '<marquee direction="up" loop="true" scrollamount="2">';
    	while($row = mysql_fetch_array( $result )) {
    		echo $row['post'];
    		echo '<br />';
    	} 
    	echo '</marquee>';
    
    }
    ?>
    
    </body>
    </html>
    The three bits in yellow you need to change to you're database username, database password, and the name of the database you want to store the information in.

    After that, open up phpmyadmin (should be installed on your webhost) navigate to the database you've made, then run this sql code under the sql tab.

    Code:
    CREATE TABLE userPosts(
    id INT NOT NULL AUTO_INCREMENT, 
    PRIMARY KEY(id),
    post VARCHAR(100),
    timeObject VARCHAR(14),
    ip VARCHAR(20))
    The two numbers in red should match up. This the maximim(?spelling?) number of characters you want users to be able to post. Anything after that number will be deleted.

    If you've got any questions, don't hesatate to ask.
    Last edited by keyboard; 05-09-2012 at 01:59 AM.

  9. The Following User Says Thank You to keyboard For This Useful Post:

    JBest (05-09-2012)

  10. #7
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,510
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    One more thing;
    The <marquee> tag is only supported by IE. In all the other browsers, it won't do anything...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •