|
-
.
Hi,
Lets see if we can help you,
the button on (click) will not work, its on (press), but try this,
all on the time line. with your button called myButton, remove the code placed on your button
PHP Code:
// *** Get initial value loadText = new LoadVars(); loadText.onData = function(ok) { if (ok) { Field2.text = ok; } }; loadText.load("text.txt"); // *** Button press myButton.onPress = function() { SubmitData(); }; // *** Send Data function SubmitData() { trace("Sent"); var outLV = new LoadVars(); outLV.hsdata = Field1.text; var inLV = new LoadVars(); inLV.onData = DataReturned; outLV.sendAndLoad("host.php",inLV,"POST"); } // *** Received data function DataReturned(ok) { if (ok) { trace("Received"); Field2.text = ok; } }
for the corresponding php file use this
PHP Code:
<?php
$mytxt = $_POST['hsdata']; $myfile = "text.txt";
$fh = fopen($myfile,'w'); fwrite($fh, $mytxt); fclose($fh);
echo $mytxt;
?>
this is basic, and I think you want to add up numbers for your counter, but get this working first then we can do the counting after.
for that you need to read the file first, then add 1 to the number, write it, close it then display it.
I'm not so sure why your are being asked for password, i use apache, wamp ect and dont get asked for password unless i make it ask for one.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|