Jump to content

Recommended Posts

I am having a problem with sending the value from a checkbox to a mysql table. If the box is not checked I want to send a 0 if it is I want to send a 1, I also eant to treat the column as an int.

How can I do this?

My input field looks like this:

<td align="left" valign="top">Allow Duplicates</td>

<td colspan="2" align="left" valign="top"><input type="checkbox" name="allow_dupes" id="allow_dupes" value="0" /></td>

mu php code is like this:

extract($_POST);

$sql="INSERT INTO `mylog` (`callclub`, `arrlsect`, `ituzone`, `ituregion`, `grid`, `utcoffset`, `contest`, `logname`, `crossmode`, `xmitters`, `numoperators`, `numstations`,`time_date`, `assisted`, `power`, `overlay`, `allowdupes`, `rrst`, `rdatetime`, `rcallsign`,`rsection`,`rzone`,`rband`,`rmode`,`rfrequ`,`rregion`,`rgridlog`, `srst`, `sdatetime`, `scallsign`,`ssection`,`szone`,`sband`,`smode`,`sfrequ`,`sregion`,`sgridlog`,`name`, `address`, `city`, `state`, `zip`, `country`,`soap1`, `soap2`) VALUES('$call_club','$arrl_section','$itu_zone','$itu_region','$grid','$utc_offset','$contest_name','$log_name','$cross_mode','$numofxmit','$numofops','$numofstations','$timedate','$assistedyn','$power','$overlay_name','$allow_dupes','$rlog_rst','$rlog_date','$rlog_callsign','$rlog_section','$rlog_zone','$rlog_band','$rlog_mode','$rlog_frequency','$rlog_region','$rlog_grid','$slog_rst','$slog_date','$slog_callsign','$slog_section','$slog_zone','$slog_band','$slog_mode','$slog_frequency','$slog_region','$slog_grid','$contact_name','$contact_address','$contact_city','$contact_state','$contact_zip','$contact_country','$soap1','$soap2')";

if (!mysql_query($sql,$con))

Thanks

Link to comment
https://forums.phpfreaks.com/topic/270466-checkboxes/
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.