title: Creating an array from textarea
body: <p>I am trying to put some data into Amazon's simpledb.  I need to enter multiple values for an attribute (comma separated), but as I have the script now it's entering all the values as one attribute.  I think I need to create an array from the comma separated values in the textarea, but I don't know how to do that.  Heck, I don't really know how to ask this question correctly.  :)</p>
  
  <p>Here's the code.</p>
  
  <pre><code>&lt;?php require_once('./simpledb/config.inc.php');  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;Input Cities&lt;/h1&gt;
  &lt;?php
  $domain = "states";
  if (!empty($_POST["state"])) {  // if a value is passed from the key input field save it
  $state = $_POST["state"];
  } else {
  $state = "";
  }
  $state = stripslashes($state);  // remove PHP escaping 
  
  if (!empty($_POST["cities"])) { // if a value is passed from the key input field save it
  $cities = $_POST["cities"];
  } else {
  $cities = "";
  }
  //$cities = stripslashes($cities);  // remove PHP escaping 
  
  ?&gt;
  &lt;FORM ACTION="addcities.php" METHOD=post&gt;
  
  &lt;label&gt;State (Caps)&lt;/label&gt;&lt;br&gt;
  &lt;input type=text name="state" size=10 value="&lt;?php echo $state; ?&gt;"&gt;&lt;br&gt;
  &lt;label&gt;Cities ('' &amp; comma seperated)&lt;/label&gt;&lt;br&gt;
  &lt;textarea name="cities" cols=60&gt;&lt;?php echo($cities); ?&gt;&lt;/textarea&gt;&lt;br&gt;
  &lt;INPUT TYPE=submit VALUE="Add Cities"&gt;
  
  
  &lt;?php
  
  if (!class_exists('SimpleDB')) require_once('./simpledb/sdb.php');  
  
  $sdb = new SimpleDB(awsAccessKey, awsSecretKey);    // create connection
  
  $item_name = $state; 
  //$input_cities = array("value" =&gt; array($cities));
  echo "&lt;p&gt;putAttributes() item $item_name&lt;br&gt;"; 
  //$putAttributesRequest["make"] = array("value" =&gt; "Acura"); // Example add an attribute
  $putAttributesRequest['City'] = array("value" =&gt; array("Blue","Red")); // Add multiple values
  </code></pre>
  
  <p>The previous line is the manual way of adding your multiple values into the attribute.  I tried doing the following, which gets the value of the text area, but as I mentioned earlier it just creates one value that's comma seperated vs. multiple values.</p>
  
  <p><code>$putAttributesRequest['City'] = $input_cities; // Add multiple values</code></p>
  
  <p>The following is just the rest of the code.</p>
  
  <pre><code>$rest = $sdb-&gt;putAttributes($domain,$item_name,$putAttributesRequest);
  if ($rest) {
  echo("Item $item_name created");
  echo("RequestId: ".$sdb-&gt;RequestId."&lt;br&gt;");
  echo("BoxUsage: ".$sdb-&gt;BoxUsage." = " . SimpleDB::displayUsage($sdb-&gt;BoxUsage)&lt;br&gt;");
  } else {
  echo("Item $item_name FAILED&lt;br&gt;");
  echo("ErrorCode: ".$sdb-&gt;ErrorCode."&lt;p&gt;");
  }
  
  ?&gt;
  </code></pre>