...

View Full Version : Resolved mixed coding - check box array - PHP Jquery HTML - sussed it!



Phil Jackson
09-08-2009, 03:52 PM
Hello all, this is a mixed coding problem so here goes.



...
<li class="checkboxes"><label for="paragraphs">Paragraphs </label><input type="checkbox" id="paragraphs" name="itemsToclear[]" value="p" /></li>
<li class="checkboxes"><label for="images">Images </label><input type="checkbox" id="images" name="itemsToclear[]" value="img" /></li>
<li class="checkboxes"><label for="headings">Headings </label><input type="checkbox" id="headings" name="itemsToclear[]" value="h" /></li>
<li class="checkboxes"><label for="forms">Forms </label><input type="checkbox" id="forms" name="itemsToclear[]" value="form" /></li>
<li class="checkboxes"><label for="links">Links </label><input type="checkbox" id="links" name="itemsToclear[]" value="a" /></li>
...

Is the HTML. Simply some checkboxes...

jQuery: (only the bit that is needed)



var clearData = $("input:checkbox[name=itemsToclear]:checked");
$("label").css("color","#404040");
$("#insertPageAjaxDiv2").html("");
if( $("#titleBox").val() !== "")
{
if( $("#fileNameBox").val() !== "")
{
if( $("#keywordBox").val() !== "")
{
if( $("#descriptionBox").val() !== "")
{
$("#insertPageAjaxDiv").html('Processing Form data... <img src="images/loader.gif" />');
var dropDown1 = $("#quickElementEdit :selected").text();
$.ajax({
type: "GET",
data: 'formProcess=df87we886f6g7d6fg7f6gf&pg=' + hiddenPage + '&template=' + template + '&titleBox=' + titleBox + '&fileNameBox=' + fileNameBox + '&keywordsBox=' + keywordsBox + '&descriptionBox=' + descriptionBox + '&clearData[]=' + clearData,


and the PHP: (only bit that is needed)



$clearData = $_GET['clearData'];

foreach($clearData as $data)
{
echo $data;
}



The output being [object Object]

cant see where its going tits up.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum