yazah Posted February 6, 2011 Share Posted February 6, 2011 I have a script that when you click search it puts money into the script demo http://www.1234sites.info/333/test.html But when you refresh the page the money goes away.I want it to stay there. Any suggestions please and thanks. Quote Link to comment https://forums.phpfreaks.com/topic/226843-php-code-help/ Share on other sites More sharing options...
Pikachu2000 Posted February 6, 2011 Share Posted February 6, 2011 Store the amount in a $_SESSION var, or a cookie and increment that instead. Quote Link to comment https://forums.phpfreaks.com/topic/226843-php-code-help/#findComment-1170488 Share on other sites More sharing options...
yazah Posted February 6, 2011 Author Share Posted February 6, 2011 I dont know how to do that.I got the code made long ago.Anyone can help me please do so.I can send you the script if you can fix it for me..Thanks Quote Link to comment https://forums.phpfreaks.com/topic/226843-php-code-help/#findComment-1170489 Share on other sites More sharing options...
yazah Posted February 6, 2011 Author Share Posted February 6, 2011 here is the code.It is suppose to get stored in the data.txt file. Thanks <html> <head> <title>Register Yourself</title> </head> <script type="text/javascript"> function test() { var donation=document.getElementById("test").value; if (donation == null) { donation=0.0000; } var newdonation=donation+0.0001; document.getElementById("test").value=newdonation; document.getElementById("test").innerHTML="$"+newdonation.toFixed(4); } </script> <body> <input type="button" value="Search" onClick="test()"/> <div id="test" value=0>$0.0</div> <div id="result"> </div> <!-- end #mainContent --> </div><!-- end #container --> </div><script type="text/javascript">var obj = "search"; //Id name to call upData function when clickedvar target = "result"; //Id name of element to display resultvar url = "data.php"; //Url to server processing file data.php$(document).ready(function() { upData(0.000); $("#"+obj).click(function() { upData(0.001); });});function upData(data) { $.ajax({ type: "GET", url: url, data: "action=do&data="+data, success: function(msg) { $("#"+target).html('$'+msg); } });} </script></body></html> Quote Link to comment https://forums.phpfreaks.com/topic/226843-php-code-help/#findComment-1170491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.