
May 16th, 2011, 08:44 PM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 3
Time spent in forums: 27 m 35 sec
Reputation 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(10e16, 10e20);
$n = base_convert($m, 10, 36);
$1 = $m;
$2 = $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?
|