#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    3
    Rep Power
    0

    Add a counter to main page


    So I need some help with adding a counter to my script.

    So i have 2 files,

    A index.php(I deleted some stuff for sake of privacy)
    PHP Code:
    <?php
    $number 
    0;
    echo <<<END
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <html> 
    <body>
    <form action ="send.php" method= "post">
    <center> <p>
    <label><b><big><big><big><big><big><big><big>SMS Killer</big></big></big></big></big></big></big></b></label>

    </p>
            <p>
                <p>
               <label><strong><u>mn</u></label>
                </p>
               <input name = "mn"

               type = "text"

                value = ""/>

            </p>
            
            <p>
                <p>
               <label><strong><u>Amount</u></label>
                </p>
               <input name = "count"

               type = "text"

                value = "1"/>
                </p>
                
                <p>
                    <p>
                    <label><strong><u>Provider</u></label>
                    </p>
        <select name="provider">

               

              </select>
              
            </p>
            
            <p>
            <input name = "Submit" type = "submit"

               value = "Send"></a>
            </p>
           <p>
           <div id="number">
            This has happened <span id="counter">
    {$number}</span> times.
           </div>
           </p>
            </center>
    </body> </html>


        </style>
    </head>
    <style type="text/css">
    <!--
    body {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
        font-style: normal;
        line-height: normal;
        color: #FF0000;
        background-color: #000000;
    }
    .style7 {color: #FF0000}

    END;
    ?>
    and send.php

    PHP Code:
    <?php

    $mn 
    $_POST['mn'];

    $count $_POST['count'];

    $provider $_POST['provider'];


    for (
    $i 0$i $count$i++) {

        
    $m rand(10e1610e20);
        
        
    $n base_convert($m1036);

        $
    $m;

        $
    =  $n;

    }

    ?>
    So what happens is the user fills in info in the index file then clicks submit, it then takes this info to send.php and completes a loop with it.

    What I want to happen is the number variable in
    Code:
    This has happened <span id="counter">{$number}</span> times.
    to add 1 to itself everytime the loop in send.php happens. I have been told that this code
    Code:
    var ctr=parseInt($('#counter').text())+1;
    $('#counter').text(ctr);
    could accomplish this by putting it in the loop but i cant figure out how to get it to work.

    Any help?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    3
    Rep Power
    0
    Come on, someone has to know

IMN logo majestic logo threadwatch logo seochat tools logo