Hi everybody !
I am currently writing a webpage that displays a list of records (
each record has a checkbox associated with it) to allow users to
select any record they want to delete (much like in "hotmail" or
"yahoo" e-mail where u can select particular message to delete) ?
Anybody have any idea how to do it ?
And one more question, I like to write my page so that when the user
click on a checkbox associated with a record. That record (that row)
is highlighted (like in "hotmail"), anybody has any idea how to do it
?
Any idea, example in php would be greatly appreciated !
Thank you in advance !
Jay 4 4633
In article <56************ **************@ posting.google. com>, Jay wrote: Hi everybody !
I am currently writing a webpage that displays a list of records ( each record has a checkbox associated with it) to allow users to select any record they want to delete (much like in "hotmail" or "yahoo" e-mail where u can select particular message to delete) ?
Anybody have any idea how to do it ?
Thus you go ahead, and write your html with checkboxes. You probably
have a unique id to identify each message. Pass that idea as the value
for each checkbox.
Next thing to do is use print_r($_REQUE ST), print_r($_POST) and print_r($_GET) )in the script that processes the form. This should give you a good idea to find the values you need.
And one more question, I like to write my page so that when the user click on a checkbox associated with a record. That record (that row) is highlighted (like in "hotmail"), anybody has any idea how to do it ?
I think you're better off using JavaScript for that. With a decent
search engine you should be able to find a site called, alistapart, and
they recently had a similar table marker higlight article.
-- http://home.mysth.be/~timvw
Jay,
I know the example you gave isn't your real problem, but I'm using it
anyways:
messages.html:
<form action="deletem sg.php" method="post">
<input type="checkbox" name="msgID_1" value="yes" checked>
<input type="checkbox" name="msgID_2" value="yes" checked>
<input type="checkbox" name="msgID_3" value="yes" checked>
<input type="checkbox" name="msgID_4" value="yes" checked>
<input type="checkbox" name="msgID_5" value="yes" checked>
<input type="checkbox" name="msgID_6" value="yes" checked>
<input type="sumit" value="Delete them!">
</form>
deletemsg.php:
<?php
for($loopvar = 1; $loopvar <= 6; $loopvar++)
{
if ($_POST["msgID_" . $loopvar] == "yes")
{
//stuff to delete msg here
}
}
?>
Note: I didn't test this code. I might not work - tell me if you find
something wrong with it.
~Eric
My PGP public key: http://www.parabolagames.com/chem/pgppubkey.txt
"Jay" <ar********@yah oo.com> wrote in message
news:56******** *************** ***@posting.goo gle.com... Hi everybody !
I am currently writing a webpage that displays a list of records ( each record has a checkbox associated with it) to allow users to select any record they want to delete (much like in "hotmail" or "yahoo" e-mail where u can select particular message to delete) ?
Anybody have any idea how to do it ?
And one more question, I like to write my page so that when the user click on a checkbox associated with a record. That record (that row) is highlighted (like in "hotmail"), anybody has any idea how to do it ?
Any idea, example in php would be greatly appreciated !
Thank you in advance !
Jay
Eric Stein wrote: Jay, I know the example you gave isn't your real problem, but I'm using it anyways:
messages.html: <form action="deletem sg.php" method="post"> <input type="checkbox" name="msgID_1" value="yes" checked> <input type="checkbox" name="msgID_2" value="yes" checked> <input type="checkbox" name="msgID_3" value="yes" checked> <input type="checkbox" name="msgID_4" value="yes" checked> <input type="checkbox" name="msgID_5" value="yes" checked> <input type="checkbox" name="msgID_6" value="yes" checked> <input type="sumit" value="Delete them!"> </form>
deletemsg.php: <?php
for($loopvar = 1; $loopvar <= 6; $loopvar++) { if ($_POST["msgID_" . $loopvar] == "yes") { //stuff to delete msg here } }
?>
Note: I didn't test this code. I might not work - tell me if you find something wrong with it. ~Eric
My PGP public key: http://www.parabolagames.com/chem/pgppubkey.txt
"Jay" <ar********@yah oo.com> wrote in message news:56******** *************** ***@posting.goo gle.com...
Hi everybody !
I am currently writing a webpage that displays a list of records ( each record has a checkbox associated with it) to allow users to select any record they want to delete (much like in "hotmail" or "yahoo" e-mail where u can select particular message to delete) ?
Anybody have any idea how to do it ?
And one more question, I like to write my page so that when the user click on a checkbox associated with a record. That record (that row) is highlighted (like in "hotmail"), anybody has any idea how to do it ?
Any idea, example in php would be greatly appreciated !
Thank you in advance !
Jay
I usually do it like this:
messages.html:
<form action="deletem sg.php" method="post">
<input type="checkbox" name="msgID[]" value="1" checked>
<input type="checkbox" name="msgID[]" value="2" checked>
<input type="checkbox" name="msgID[]" value="3" checked>
....
<input type="checkbox" name="msgID[]" value="x" checked>
<input type="submit" value="Delete them!">
</form>
deletemsg.php:
<?php
$idarray = '(' . implode(',', $_POST['msgID']) . ')';
$query = "DELETE FROM `table` WHERE msgID IN $idarray";
// Process query here
?>
Jay <us**@isp.tld > wrote in message news:<40******* ***@newspeer2.t ds.net>... Eric Stein wrote: Jay, I know the example you gave isn't your real problem, but I'm using it anyways:
It is my real problem actually. The real webpage is a little bit more
complicated than this. But I got stuck at the checkbox thing. Thank
for your help though. I am glad my problem is solved.
Thanks
Jay This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Danny Anderson |
last post by:
Hola, PHP folk!
I have a php page that contains a self-processing form. The form holds
search results. The search terms originally came from the previous page,
but the user can repeatedly refine the results on the page in question
until the target item can be found. This search refinement is where the
self-processing form comes to play.
The search results are listed in a table with a radio button at the end of
each row. What I...
|
by: Old Lady |
last post by:
Hi all, I have a problem when I try to send an array using a form when
the type="checkbox".
This is my form input row:
<INPUT type="Checkbox" name="flg" value="y" <? if($row ==
'y') echo 'CHECKED'; ?>>
Since this is an update form, I set the status of the flg according
to the field "flag" stored in a MySQL database. The user may check or
|
by: Yaron C. |
last post by:
Hello,
I would like to ask for your help.
I am trying to create a page with table of many form elements.
The size of the table is 84x10 (84 rows, 10 columns) and each cell
contains 1 form element (select box, checkbox, etc ...)
As you can see I have 840 form elements in the page.
|
by: Edward |
last post by:
The below code builds 2 tables 4 rows by 4 cols. All cells have
checkboxes. When checked, the checkboxes in the first column
automatically check the remainder of the check boxes in the same row.
This is working fine for tables of this size. Unfortunately, my app
produces lots of considerably bigger tables and the 'toggle' can take
over a minute to complete!!
I assume this is because for each toggle, the all form elements are
searched...
|
by: Leo J. Hart IV |
last post by:
OK, here's another question for the experts:
I am building a multi-step (3 steps actually) form using a panel for
each step and hiding/displaying the appropriate panel/panels depending
on which step you're on. This all works fine, but I ran into some
trouble when I started creating controls dynamically in my code-behind
file.
Each panel contains a table which is filled with various radio buttons,
text fields and the such which are...
| |
by: Philip Wagenaar |
last post by:
I have made a form with a tab that containts groupboxes and those contain
checkboxes.
When I run the application sometimes the outlining for some groupboxes are
not shown, if I switch tabs and back sometimes all outlining is shown and
sometimes are not shown. I have no idea what is going wrong.
What also is weird is that when I open the form from my main application I
can resize the form, even though it is locked, and that when I cut...
|
by: tcertain |
last post by:
I am totally duh at javascript although I have 2 books trying to learn it.
I am trying to add values to a form and have a calculate total at end.
this is my form script. I have hours at end of each radio or checkmark. (If this is checked, add these hours. ) I want to calculate total at the calculate button at the bottom of the form and have a window that shows the total.
please excuse the long form, but with all the different...
|
by: arty |
last post by:
So basically i have a form with a action attribute set to another form, it is a survey spread among several pages and using php sessions, now im trying to validate the form with Javascript but it looks imposible because the check boxes all have the same name Q1(and the array symbol is conflicting with js), the same name is needed for processing the answers with php in the database, i am able to make a form validation of the form below using...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |