javascript - How can i transfer a value in php? -


i have html-file , php-file. index.html transfers value php script ajax. want servo.php file writes every value gets index.html in file /dev/servoblaster.

you can find files here:

html-file

php-file

question: in example value want transfer p1-11=160. want value (and not create single switch every value).

if( isset($_get['dir']) ) {     // $_get['dir'] -> direction (up|dn|lt|rt|stop)      $handle = fopen("/dev/servoblaster", 'w');              switch($_get['dir']) {                     case "p1-11=160":                             fwrite($handle, "p1-11=160\n"); //write in /dev/servoblaster - p1-11=160                             break;             }              fclose($handle);      } 

instead of having switch statement looking specific text write, following:

$handle = fopen("/dev/servoblaster", 'w'); fwrite($handle, $_get['dir']."\n"); fclose($handle); 

hence value save literally wrote in input field in html file.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -