Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-08-2009, 02:52 PM   PM User | #1
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
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 03:40 PM..
Phil Jackson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:53 AM.


Advertisement
Log in to turn off these ads.