473,385 Members | 2,029 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,385 software developers and data experts.

How-to select items from a list

I'm trying to do something and I'm sure there is a good technique for
it, but I just can't figure it out.

I have some member records in a database. I want to display a list of
them, and have a checkbox next to each member. One can then click in
the checkboxes for one or more members and the next page should then
take action on the selected members.

I know how to get the members from the database, I know how to create
the form to display each member with a checkbox next to their name.

What I can't figure out is a good method to name/identify the
checkboxes so that the values passed to the next URL can be
programatically processed in a loop.

I'll try and demonstrate:

List:
<form action="sendsms.php">
<table>
<!-- I'm outputting this in a while loop -->
<tr>
<td><input type=checkbox name=?? value=$mem_id></td>
<td>$member_name</td>
</tr>
<!-- end while loop -->
</table>
<input type="submit" value="Submit">
</form>

I assume that the $id (unique member id) would be a good value for the
checkbox to have, but I don't know what to name the checkbox so that
in the action URL I can loop through the values to process those
selected?

Thanks for any help.
Jun 27 '08 #1
3 1386
On Jun 12, 12:31 pm, MikeB <MPBr...@gmail.comwrote:
I'm trying to do something and I'm sure there is a good technique for
it, but I just can't figure it out.
[snip]
>
Thanks for any help.
I've made some progress with this (Google is good!), but I've got a
little problem I can't figure out. Is there somewhere that I can post
some php code to for people to look at and tell me what I'm doing
wrong? Thanks!

I found some information that indicates that if the name of the
checkbok has square braces ([]) it should be able to get the data from
the $_POST variable with a statement like:

$sendlist=$_POST['sendid'];

However, I come up with nothing in the resulting array.

I can post a sample program if anyone would tell me where and would be
willing to look at it.

Thanks again.
Jun 27 '08 #2
MikeB wrote:
On Jun 12, 12:31 pm, MikeB <MPBr...@gmail.comwrote:
>I'm trying to do something and I'm sure there is a good technique for
it, but I just can't figure it out.
[snip]
>Thanks for any help.

I've made some progress with this (Google is good!), but I've got a
little problem I can't figure out. Is there somewhere that I can post
some php code to for people to look at and tell me what I'm doing
wrong? Thanks!

I found some information that indicates that if the name of the
checkbok has square braces ([]) it should be able to get the data from
the $_POST variable with a statement like:

$sendlist=$_POST['sendid'];

However, I come up with nothing in the resulting array.

I can post a sample program if anyone would tell me where and would be
willing to look at it.

Thanks again.
Just post it here. If it's large, trim it down to a manageable size
that shows the problem.

But if you have:

<input type=checkbox name='sendid[]' value=$mem_id>

$_POST['sendid'] will be an array with one element for each checked
checkbox. Unchecked boxes will not send their value.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #3
On Jun 12, 2:52 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
MikeB wrote:
On Jun 12, 12:31 pm, MikeB <MPBr...@gmail.comwrote:
I'm trying to do something and I'm sure there is a good technique for
it, but I just can't figure it out.
[snip]
Thanks for any help.
I've made some progress with this (Google is good!), but I've got a
little problem I can't figure out. Is there somewhere that I can post
some php code to for people to look at and tell me what I'm doing
wrong? Thanks!
I found some information that indicates that if the name of the
checkbok has square braces ([]) it should be able to get the data from
the $_POST variable with a statement like:
$sendlist=$_POST['sendid'];
However, I come up with nothing in the resulting array.
I can post a sample program if anyone would tell me where and would be
willing to look at it.
Thanks again.

Just post it here. If it's large, trim it down to a manageable size
that shows the problem.

But if you have:

<input type=checkbox name='sendid[]' value=$mem_id>

$_POST['sendid'] will be an array with one element for each checked
checkbox. Unchecked boxes will not send their value.
Finally figured this out. A really dumb (newbie?) mistake.

I was using "Get" as the method for the form, so that I could see the
parameters being passed in the URL. Obviously $_POST doesn't see those
parameters, but $_GET does.

So it's all fixed now.

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom Szabo | last post by:
Just wandering how can you close a browser remotely. In some web applications the browser closes or refreshes periodically. How is that done and how can it be done through PHP? TIA, Tom
15
by: Reid Nichol | last post by:
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
0
by: v I n O | last post by:
hI Geeks Please do let me know how do i find how many instances sql server running on the single machine. or in the n/w my objective should with help of C#/vb.net
2
by: Frances Del Rio | last post by:
http://www.emol.com/especiales/cocina_chilena/comida.asp this page is so neat (goes in pop-up..) how was this done? how do you give a layer (or div, I guess) a semi-transparency so you can still...
4
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I...
3
by: dba2adm | last post by:
The SNAPSHOT_STATEMENT table function gives the CPU used rows read etc information. How do I know the total number of time the particular statement was executed (as in snapshot_dyn_sql's...
2
by: flywave | last post by:
hi,who can help me ?i came into a problem that how can i get a packet which was send in the LAN.in a word ,how the sniffer works. I once used the rawsocket in win2000 or xp,and it do catch. but...
7
by: anushhprabu | last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.....
0
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web...
2
by: belred | last post by:
i just read this blog about how many objects (types) are loaded for a hello world program in C#. http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.