Page 1 of 1
starting variable
Posted: Sat Jan 15, 2011 4:39 am
by pretender5552
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?
Re: starting variable
Posted: Sat Jan 15, 2011 5:12 am
by PaxBritannia
There are 2 main ways to do this:
1: use a get to pass a variable through a link
Code: Select all
<a href src="levelup.php">Level up!</a>
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.
Re: starting variable
Posted: Sat Jan 15, 2011 5:18 am
by pretender5552
Isn't there a way to do it without sending them to another page?
Re: starting variable
Posted: Sat Jan 15, 2011 5:53 am
by PaxBritannia
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.