Topic: Php question

ok i have this code i was trying to work on

<?php 
$i=0;
$p="%";
while($i<=100)
{
echo $i . "" . $p;
$i++;
}
?>

is there a way i can get it to clear the # like right before $i++ so it looks like its counting up so as soon as 1 changes is 2?

2 (edited by chrizz 2004-12-01 02:44)

Re: Php question

I try to understand your question, but I can't smile .. You could either wait and hope someone else understand or you could try to explain better what you want smile

Re: Php question

i dont know what you mean.. same like that, try this...

<?
for($i=0;$i<=100;$i++){

    echo "$i %";

}
?>
God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

Re: Php question

I don't think you can remove stuff you have put out in php, not on HTML (perhaps on local scripts) ...

if you want something that counts up on a page, you probably need javascript or something ...

5 (edited by sverrir 2004-12-01 14:43)

Re: Php question

This is a javascript job.

You can go a dirty and expensive way if you insist on using server programing.

You can get the counter from the url and by using meta-refresh set on... say 1 sec you could then count upwards. But as I said, VERY dirty and loads your server.
i.e.

$c = $_GET['counter'];
$c++;
echo '<META HTTP-EQUIV="refresh" content="1;URL=page.php?counter"'.$c.'>'; 

Use javascript smile

Re: Php question

I was just experimenting with PHP... so anyways what i was trying to do is make a PHP loader like it echo's 1% on the screen then i wanted to find a way to erase the 1% then it echo's in 2% and it keeps doing it up to a hundred but anyways it didnt work but if anyone wants the code i have here it is

<html>
<body>
<table align="center" width="200" border="1" bordercolor="#55110E" cellspacing="0" cellpadding="0" valign="bottom">
<tr><td bgcolor="#9D2012"><font face="verdana" size="2">
<center>
<?php 
$i=0;
$p="%";
while($i<=100)
{
echo $i . "" . $p;
$i++;
}
?>
</center>
</font></td></tr></table>
</body>
</html> 

Re: Php question

The time taken to load the page will be very very less. almost negligible... then how can you see that loading of page using PHP script.... within fraction of second it will vanish buddy!..

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily