Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts

    mixed coding - check box array - PHP Jquery HTML - sussed it!

    Hello all, this is a mixed coding problem so here goes.

    Code:
    ...
    <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)

    Code:
    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)

    PHP Code:
    $clearData $_GET['clearData'];
                                                        
    foreach(
    $clearData as $data)
    {
    echo 
    $data;

    The output being [object Object]

    cant see where its going tits up.
    Last edited by Phil Jackson; 09-08-2009 at 04:40 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •