Solved

PHP HTML POST Arrays and Checkboxes

Posted on 2007-04-03
3
250 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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