Solved

PHP HTML POST Arrays and Checkboxes

Posted on 2007-04-03
3
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

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

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

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

688 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