Jump to content

[SOLVED] checkbox


corillo181

Recommended Posts

i WAS TRYING TO GET MULTIPLE CHECKBOX INTO ONE MYSQL FIELD BUT I ALWAYS GET ONLY

 

ARRAY

 

IN THE FIELD

 

I HAVE IT SET UP LIKE THIS

if($_post['submit']){
$allChecked=explode(',',$_post['options']);

$insert=mysql_query("INSERT INTO table(checked)V('$allCheck')")or die();
}

Link to comment
Share on other sites

 

 

IN THE FIELD

 

I HAVE IT SET UP LIKE THIS

if($_post['submit']){
$allChecked=explode(',',$_post['options']);

$insert=mysql_query("INSERT INTO table(checked)V('$allCheck')")or die();
}


^^^^ serious about that????
show us the real code if thats the real code that a big bug///?????????
ASTIG!!!

Link to comment
Share on other sites

everything else works fine in the insert

$year=$_POST['year'];
$month=$_POST['month'];
$day=$_POST['day'];
$do=explode(',',$_POST['no']);
$thisyear=date("Y");
$thismonth=(int)date("m");
$nextyear=$thisyear+1;
$jd=cal_to_jd(CAL_GREGORIAN,$month,date(1),$year);
$monthname=jdmonthname($jd,1);
$array=array(1=>'January','February','March','April','May','June','July','August','September','October','November','December');
$where=$_POST['where'];
$who=$_POST['who'];

if(isset($_POST['Submit'])){
$insert=mysql_query("INSERT INTO tra_party(user_id,party_year,party_month,party_day,nos,place,who) VALUES('$user_id','$year','$month','$day','$do','$where','$who')")or die(mysql_error());
}
?>

Link to comment
Share on other sites

my form is a little complicated i don't know if you going to be able to tell , but here it is.

 

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<fieldset id="timeselect">

<label for="year" id="yearLabel"><span>Year</span>

<select name="year" id="year" onchange="form.submit();">

<? if(empty($year) || $year=='Select'){?><option value="Select" selected="selected">Select</option>
<? for($i=$thisyear;$i<=$nextyear;$i++){
?><option value="<?=$i?>"><?=$i?></option>
<? }}if($year!=''){?><option value="<?=$year?>" selected="selected"><?=$year?></option><? }?></select></label>
  

<? if($year!=''){?> <label><span>Month</span><select name="month" id="month" onchange="form.submit();"><? if($month==''){?>
<option value="0" selected="selected">Select Month</option>
<? }?><? if($year==$thisyear){
$start = $thismonth;
for($i = $start; $i < count($array); $i++){
?><option value="<?=$i?>"><?=$array[$i]?></option>
<? if($month==$i){?><option value="<?=$i?>" selected="selected"><?=$array[$i]?></option>
<?
}}}else{
$start = 1;
for($i = $start; $i < count($array); $i++){?>
<option value="<?=$i?>"><?=$array[$i]?></option><?
if($month==$i){?>
<option value="<?=$i?>" selected="selected"><?=$array[$i]?></option><?
}}}?></select></label><? }?>
  
  
<? if($month!=''){?> 
<label><span>Days</span><select name="day" id="day" onchange="form.submit();"><option value="Select" selected="selected">Select Day</option>
<?
$numdaysinmonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
for($count=1;$count<=$numdaysinmonth;$count++){?>
<option value="<?=$count?>"><?=$count?></option>
<? }?></select></label><? }?>
</fieldset>
<? if($day!=''){?>
<fieldset>
<label><span>party-type:</span>
<select name="partitype" id="partitype">
  <option value="select" selected="selected">Select Type</option>
  <option value="house">House</option>
  <option value="club">Club</option>
  <option value="other">Others</option>
</select>
</label>
<p>Check For No's : </p>
<label>
<input name="no[]" type="checkbox" id="beads" value="beads" />
Beads</label>
<label><input name="no[]" type="checkbox" id="headgear" value="headgear" />
Head Gear</label>
<label><input name="no[]" type="checkbox" id="vaggie" value="vaggie" />
Vagie clothes</label>
</fieldset><? }?>

<fieldset>
<label><span>Where</span><input name="where" type="text" id="where" />
</label>
<label><span>Who's</span>
<input name="who" type="text" id="who" />
</label>
</fieldset><button type="submit" name="Submit" id="Submit">Submit</button></form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.