Solved

PHP HTML POST Arrays and Checkboxes

Posted on 2007-04-03
3
223 Views
Last Modified: 2013-12-12
Making an fairly large html form across 8 pages that updates a mysql database and then fills out a pdf.

My question has to do with pages auto-populating with session variables if the user has already been to that page. Pretty easy.
However, I have a lot checkboxes, so I'm looking for advice. The checkboxes are obviously posted as arrays (have to use POST)
Is there a simple way to see if an array contains a value without looping through it?

I have to put the arrays into a database in the form of values like 01/02/03/04 - should I go ahead and make my string an then regular expression search?

Is there a better option. I know I can do it, I'm looking for efficiency here - I'm talking up to 500 checkboxes a page on some of these - I don't want to loop through an array to see if it contains a value 500 times - I'm guessing there is a better option to set a checkbox to checked if it is supposed to be.

Thanks in advance
0
Comment
Question by:chuckbeats
3 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 500 total points
Comment Utility
you can use array_search to search through the array

http://www.php.net/manual/en/function.array-search.php
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now