Jump to content

Recommended Posts

Posted

I'm currently making a web-controller in autoIT and PHP.

Well its not accturally the AutoIT code that is causing me problems, rather the PHP code.

I thought some of you might be able to help.

Ok so what i got here is a screenshot of my screen which the autoIT code uploads to the FTP server.

The PHP code then display it, and update every 2 sec. And that part is working fine.

However i need to be able to send commands to the client.

I use a textarea to type in the commands that then are received by the AutoIT code and the autoIT code will then remove the command and be ready for a new one.

However for some reason it won't put the textarea into a variable.

<html>
<head>
<title>Controller</title>
</head>
<body>
<form method="post" action="<?php echo $PHP_SELF;?>">
 <IMG src="Capture01.jpg" width="640" height="480" border="1" name="refresh">
      <script language="Javascript" type="text/javascript">
      <!--
      var t = 2 // interval in seconds
      image = "Capture01.jpg" //name of the image
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
      // -->
      </SCRIPT> 
<br />
<textarea rows="5" cols="32" name="quote" wrap="physical">Enter Command here</textarea><br />
<BUTTON 
    TYPE=BUTTON 
    onclick="<?php
    $File = "command.dat";
    $Handle = fopen($File, 'w');
    $quote = $_POST["quote"];
    $Data = $quote." <<<---- before this we have a problem\n";
    fwrite($Handle, $Data);
    print "Data Written";
fclose($Handle);
?>
">Submit Command</BUTTON><P>
</form>

The part with the BUTTON is causing the problem.

The file will contain "<<<---- before this we have a problem" but it won't contain the data from the textarea.

Can anyone help me?

[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Posted

You can't use PHP code "onclick" like Javascript does.

Rather put this on top of your script:

<?php
if ( isset($_POST['quote']) ) {
 // we have received a post message

    $File = "command.dat";
    $Handle = fopen($File, 'w');
    $quote = $_POST["quote"];
    $Data = $quote." <<<---- before this we have a problem\n";
    fwrite($Handle, $Data);
    print "Data Written";
    fclose($Handle)

}
?>

and then make the onclick do other stuff, or not, up to you.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...