PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ferio-moreno
Forum Commoner
Posts: 30 Joined: Tue Feb 28, 2006 10:31 pm
Location: florida
Post
by ferio-moreno » Mon Mar 06, 2006 9:41 am
hello, basic help needed, I was trying to make a code, that upon refresh, it would increment a variable by +1 each time. But it doesn't seem to quite work, i dont want to use any sessions or cookies with this.
Here's my code. any pointers?
Code: Select all
<?php
$inc = 0;
if ($inc != "20"){
$inc = $inc + 1;
}else{
$inc = 0;
}
?>
<input type="hidden" name="increment" value="<?php echo $inc; ?>" />
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 06, 2006 9:46 am
remove the first $inc = 0 occurance.
ferio-moreno
Forum Commoner
Posts: 30 Joined: Tue Feb 28, 2006 10:31 pm
Location: florida
Post
by ferio-moreno » Mon Mar 06, 2006 9:56 am
i get this
Notice: Undefined variable: inc in c:\Inetpub\wwwroot\demoform\calendar\demo_week.php on line 20
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 06, 2006 10:12 am
ferio-moreno
Forum Commoner
Posts: 30 Joined: Tue Feb 28, 2006 10:31 pm
Location: florida
Post
by ferio-moreno » Mon Mar 06, 2006 10:24 am
im just confusing myself right now (i'm an extreme novice in php).
ive used issets before but i dont know when and when not to use them in the code that i posted above....
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Mar 06, 2006 10:30 am