User Tools

Site Tools


php

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
php [2010/10/08 17:54]
tkbletsc
php [2010/10/08 18:58] (current)
tkbletsc
Line 57: Line 57:
 if (strpos($uri,'storeavalue')) { if (strpos($uri,'storeavalue')) {
  // We are storing a value in this post  // We are storing a value in this post
- $tag =trim($_POST["tag"])+ $tag   = $_POST["tag"]; 
- $value =trim($_POST["value"]); + $value = json_decode($_POST["value"]); 
 +  
 + # $value may be a string or array depending on what you sent in your app
   
  // TODO: Do something with those values  // TODO: Do something with those values
   
- echo '["STORED", "$tag""$value"]'+ echo json_encode(array("STORED", $tag, $value));
   
 } elseif (strpos($uri,'getvalue')) { } elseif (strpos($uri,'getvalue')) {
  // We are retrieving a value in this post  // We are retrieving a value in this post
- $tag = trim($_POST["tag"]);+ $tag = $_POST["tag"];
   
  // TODO; figure out value  // TODO; figure out value
- $value = "RETURN_VALUE!!"; + $value = "RETURN_VALUE!!"; $value may be a string or array depending on what your app is set up to receive
- $value array(1,2,3,"dogs",4);+
   
  echo json_encode(array("VALUE", $tag, $value));  echo json_encode(array("VALUE", $tag, $value));
php.txt · Last modified: 2010/10/08 18:58 by tkbletsc