Jump to content

[SOLVED] checkbox


corillo181

Recommended Posts

 

 

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
https://forums.phpfreaks.com/topic/56649-solved-checkbox/#findComment-279764
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
https://forums.phpfreaks.com/topic/56649-solved-checkbox/#findComment-279785
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
https://forums.phpfreaks.com/topic/56649-solved-checkbox/#findComment-279793
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.