Jump to content

Recommended Posts

For crying out loud. I've been working on this script to populate check boxes after validation and if the user uses an EDIT button. It kept dropping the first chk element And I could not find out why.

 

I turned the hidden elements holding the the array returned from the chkbox array ass a string into text inputs so I could see what was going on. Well, it started working.

 

I changes them to hidden with a css class position absolute -800 -800.

 

Anyone else have this problem with hidden elements or know what this is all about?

Link to comment
https://forums.phpfreaks.com/topic/67497-hidden-elements-causing-chk-box-problems/
Share on other sites

I thought the question was more abstract Ken2k7. Does anyone know why a hidden element would wanker a script?

 

here is an example though, part of it anyway:

 

	$array = spliti("\|", $_POST['activities']);
foreach($array AS $activity)
{	
	switch ($activity)
	{
	case 'Doberman Puppies':
		GLOBAL $pup;
		$pup = "checked='checked'";
		break;
	case 'Adult Dobermans':
		GLOBAL $adult;
		$adult = "checked='checked'";
		break;
	case 'Trained Dobermans':
		GLOBAL $trained;
		$trained = "checked='checked'";
		break;
	case 'Stud Service':
		GLOBAL $stud;
		$stud = "checked='checked'";
		break;
	case 'Doberman Rescue':
		GLOBAL $rescue;
		$rescue = "checked='checked'";
		break;		
	}
}

 

There are 5 chk elements respective to each case. If the $_POST data comes from a hidden element every time it runs the first $activity goes away, and thus the first checked element shows unchecked.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.