473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Why do ComboBox(Drop Down) values pass even with no selection or data?

Hi there,
I have 2 PHP files, memeber.php & view.php

This is my member.php
Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($strSQL)){
  2.         $data .= "<tr>";
  3.         $data .= "<td>";
  4.     $data .= "<input type='checkbox' class='memberchk' name='membersID[]' value='".$row['member_id']."' />";
  5.     $data .= "</td>";
  6.     $data .="<td>";
  7.     $data .= "".$row['name'];
  8.     $data .="</td>";
  9.  
  10.     $data .="<td>";
  11.     $data .= "<select name='access[]'>";
  12.  
  13.     $data .="<option selected value='".$row['access']."'>".$row['access']."</option>";
  14.     if($row['access'] != 'member'){
  15.         $data .="<option name='access[]' value='member'>member</option>";
  16.     }
  17.     else{
  18.         $data .="<option name='access[]' value='admin'>admin</option>";
  19.     }
  20. $data .="</select>";
  21. $data .="</td>";
I have here a database which has a table member and it has a fields name and access.
This is my view.php
Expand|Select|Wrap|Line Numbers
  1. $access = $_POST['access'];
  2. echo "access size=".sizeof($access); //array size
  3. foreach ($access as $value){
  4. echo "Access: ".$value;
  5. }
I'm getting the size of my access array, and it shows up a wrong size because even if I pass only one value it will show a size of 10 because 10 was the total count of values in my database. That's not what I wanted to do. The size of an array should be equal to the values that I put inside the $access, but that's not happening.
Help please.
Thanks!
Feb 8 '11 #1
0 1269

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: krish | last post by:
I am developing a portal using ASP.NET and C# Almost all controls i can get flat style(Using borde style proprty)except dropdownlist,listbox,checkbox how can i make these controls to the flat...
2
by: Jeff Thur | last post by:
I am running a SQL Stored Procedure that will give the user a count of how many records are in the database as per certain criteria. I'm using the Execute Scalar Method. I have no problem passing...
4
by: shlomi.schwartz | last post by:
Hi All, Is it possible to open the select (ComboBox) drop down list by script?
4
by: Vegard H. Villmones | last post by:
Hi. I have a table containing a list of about 5000 numbers, and there is also in existence one MSWord document for everyone of them numbers. I want to create some sort of drop down menu (in a...
1
by: Patrick Blackman | last post by:
I want to attach a usercontrol or form to the combobox drop down so that when I click the down arrow the usercontrol or form is shown and not the combobox dropdownlist. My aim is to create a color...
2
by: WStoreyII | last post by:
i would like to display a small three column datagrid in a combobox's drop down list any idea's on how to do this ? WStoreyII
12
by: chembuff1982 | last post by:
Here's my code, combo27 is working fine, however when I update my table Test (field Test) which works fine, I can't get Combo29 to update to the added test I just put in. I need to use the acLast or...
2
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I have a combobox on a form with dropdown style. Is it possible to 'push' the dropdown arrow button from code - causing the combobox to dropdown. regards Jesper, DK
4
by: sunnytyra | last post by:
Hi, Drop down list in combobox takes time before closing(this problem only comes when the scroller thumb is moved) . For eg : Follow these steps 1) Open a combobox drop down list . 2)...
3
by: - HAL9000 | last post by:
I am trying to get an event when the drop-down Combo Box goes away / reverts back to showing a single item. For example, clicking the box's down arrow, to remove the drop-down window, doesn't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.