localStorage only supports strings. Use JSON.stringify() and JSON.parse().
place array inside onDeviceReady and asign the json array to localStorage
On Page parse values stored in localStorage array into another json array for implimentation
PHP, MySQL, Joomla, Wordpress and other CMSes as well as CSS, jScript, jQuery related tested & trusted references links will be posted here for every PHP enthusiasts references. Enjoy
localStorage only supports strings. Use JSON.stringify() and JSON.parse().
place array inside onDeviceReady and asign the json array to localStorage
On Page parse values stored in localStorage array into another json array for implimentation
$flds = $_POST;
2. Check Every form data has been collected in ARRAY
print_r($flds);If things are fine...
Count Total # of Arrays $carray = count($flds);4. Remove "Submit" Array:
array_splice($flds,$carray);5. If you want to add few fields with default values -- the put them in form HIDDEN FIELDS or Try this to add MANUALLY:
$flds["new_field"] = "new_field_value";5. Write a Function to extract values from array and insert into MySQL Table
function mysql_insert_array($table, $data) {
foreach ($data as $field=>$value) {
$fields[] = '`' . $field . '`';
$values[] = "'" . mysql_real_escape_string($value) . "'"; }
$field_list = join(',', $fields);
$value_list = join(', ', $values);
$query = mysql_query("INSERT INTO `" . $table . "` (" . $field_list . ") VALUES (" . $value_list . ")") or die('Error in Inserting from ARRAY : ' . mysql_error());
return $query;
}
6. FINAL NAIL to Good Old Frame for "Wall of Fame" :
mysql_insert_array("tablename",$flds);
Note: This function can be used without hesitation anywhere, where there is no 2nd table or cross table data storage. Copy code BINDAAS-ly...
I've been trying lately to store selected checkbox values to an Array and show them in UL and LI lists.
if(isset($_POST["csubmit"])){ print_r($_POST['fleet']); $arr = $_POST['fleet']; echo '
--- I Have 10 Checkboxes
--- Where only selected Checkbox values need to stored into an ARRAY
Once Checkbox values stored into an Array
--- Assign those values to a Standard PHP Variable
Wow! That's Simple isn't it??? Yeh, You Bet... ----------------------------------------------------- Bay Area Taxi