starting variable
-
- Posts: 127
- Joined: Mon Jan 03, 2011 5:38 am
starting variable
In my level up system I am trying to make it so that clicking on the button will add the stat but I am not sure how to do this do you just button the code in the link?
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: starting variable
There are 2 main ways to do this:
1: use a get to pass a variable through a link
2: use a form submit button
For both, direct the user to a php page where the operations are processed. Then redirect them back to where you want.
Both ways will work, but make confirm that they are eligible to do the operation. That is, make sure they haven't just used the link several times to cheat.
pax.
1: use a get to pass a variable through a link
Code: Select all
<a href src="levelup.php">Level up!</a>
For both, direct the user to a php page where the operations are processed. Then redirect them back to where you want.
Both ways will work, but make confirm that they are eligible to do the operation. That is, make sure they haven't just used the link several times to cheat.
pax.
-
- Posts: 127
- Joined: Mon Jan 03, 2011 5:38 am
Re: starting variable
Isn't there a way to do it without sending them to another page?
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: starting variable
Once that page is loaded, there is no other way using only php.
From then on, you must use javascript or another client side script to call another php page.
I found this tutorial extremely helpful when I needed to call another script:
http://net.tutsplus.com/tutorials/javas ... ng-jquery/
Although what you want to do is a little different, you can just ignore some parts of the tutorial and focus on when they call the php script.
Hope it works out!
pax.
From then on, you must use javascript or another client side script to call another php page.
I found this tutorial extremely helpful when I needed to call another script:
http://net.tutsplus.com/tutorials/javas ... ng-jquery/
Although what you want to do is a little different, you can just ignore some parts of the tutorial and focus on when they call the php script.
Hope it works out!
pax.