PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old August 8th, 2002, 10:37 PM
alifyag alifyag is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 16 alifyag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
checkboxes again

hi,
i had posted this query earlier but maybe i wasnt too clear.
basically i have three checkboxes on my form:
GROUP TYPE : <INPUT type="checkbox" name="groupID" value="1" <? echo $gflag;?>>STUDENT
<INPUT type="checkbox" name="groupID" value="2" <? echo $gflag2;?>>PROFESSOR
<INPUT type="checkbox" name="groupID" value="3" <? echo $gflag3;?>>VISITING FACULTY

Now the value which are 1,2 or 3 are the values which are in my database table too ...example 1 for student.

i used
<?
if ($idType==1){
$flag="checked";}
else if ($idType==2){
$flag2="checked";}
else if ($idType==3){
$flag3="checked";}
else
{$flag="";}

?>

to pre-check the values in my form depending on whats in the database table which works just great.

my problem is that if the user adds or edits a record i want to insert into the table which is called users_in_groups the userID and the new groupID whcih i get from the checkbox...there will obviously be a multiple insert of rows if the user checks 2 checkboxes.
i wnt to do
if ($update)
{ foreach.....

well...i dotn know what to put in there to update...can soemone pls pls help me....i am really stuck




Reply With Quote
  #2  
Old August 8th, 2002, 10:46 PM
timmyg timmyg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: DeSoto, KS, USA
Posts: 1 timmyg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to timmyg Send a message via Yahoo to timmyg
RE: checkboxes again

why don't you try using radio buttons?
< input type = "radio" name = "groupName">

Reply With Quote
  #3  
Old August 8th, 2002, 10:53 PM
alifyag alifyag is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 16 alifyag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: checkboxes again

hi,
i cant use radio button since a person can belong to more than one group....

Reply With Quote
  #4  
Old August 9th, 2002, 08:06 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to siteworkspro.com Send a message via AIM to siteworkspro.com
RE: checkboxes again

firstly you need to rename 'groupID' to 'groupID[]' for each one.

Then

foreach($_POST['groupID'] as $id)
{
mysql("UPDATE table....");
}

something like that, just remember when updating the table, to use $id not $groupID

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > checkboxes again


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway