Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-08-2009
Member
 
Join Date: Jul 2009
Posts: 49
Checkbox array storage and retrieval in Php

I am facing some issues in Php over here i am trying to store the contents of check boxes in a field in a mysql database and retrieve them later. Can anyone provide me with the code i have try to use the below code

Code:
<input type="checkbox" name="days[]" class="other" value="Monday1" /> 
   <label class="left">Monday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Tuesday1" /> 
   <label class="left">Tuesday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Wednesday1" /> 
   <label class="left">Wednesday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Thursday1" /> 
   <label class="left">Thursday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Friday1" /> 
   <label class="left">Friday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Saturday1" /> 
   <label class="left">Saturday1</label> <br /> 
   <input type="checkbox" name="days[]" class="other" value="Sunday1" /> 
   <label class="left">Sunday1</label> <br />
Reply With Quote
  #2  
Old 03-08-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Checkbox array storage and retrieval in Php

Try to use the following code hope it works for you

HTML Code:
$b=0;
foreach ($days_as $value){
$b=$b+1;
}
for($j=0;$j<$b;$j++) 
{
echo $days[$b];
echo "<br/>";
}
Reply With Quote
  #3  
Old 03-08-2009
Member
 
Join Date: May 2008
Posts: 2,293
Checkbox array storage and retrieval in Php

When i am trying to store array i guess there should be a comma -delimated string of values but with the code it appears to have the value of array which i think that implode is not working that is $_POST['days'] array stored not as a string of values separated by commas.
Reply With Quote
  #4  
Old 03-08-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Checkbox array storage and retrieval in Php

Try to use the below code and i am sure you would be able to have implode with this code

PHP Code:
$days_array1 = array("");
foreach (
$_POST['days_1'] as $val1){
    
$days_array[] = $val1
}
$days_1 implode(",",$days_array1); 
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Checkbox array storage and retrieval in Php"
Thread Thread Starter Forum Replies Last Post
Monitor HDS USPV and HP XP storage array using CommandCentral Tam^bura Windows Software 4 29-05-2011 10:27 AM
Needing to get HDD temp readings from drive in an Intel Matrix Storage Manager array Jimmy G XP Hardware 3 06-03-2011 12:18 AM
Storage Array SSD(Intel x25-m; OCZ) Nalini_sh Hardware Peripherals 3 11-11-2009 12:39 PM
ISO image retrieval sdwivedi Windows Software 3 25-05-2009 03:37 PM
Connecting Ms Excel to vb.net retrieval & storage of data? Chandrakant81 Software Development 5 21-02-2009 10:45 PM


All times are GMT +5.5. The time now is 04:54 PM.