send value into database table using ckeckbox
Posted: Wed Apr 25, 2007 1:20 am
feyd | Please use
I am using this variable::::::::::;[/syntax]
Can anyone will help me it is urgent
Thanks & Regards
Ranjan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all,
I have four check box, i want to send 1st & 4th value of the check box into database table after selecting one or more option. ie if i select the dating and Networking, the both should store into database. example: dating, Networking in table.
I am taking the four variable and using comma i am separting the variable. But problem is that once i am select the 1st and 4th option three comma is coming inbetween dating and friend option, but i want only one comma ie dating, Networking in table.
This is the code :::::::
[syntax="html"]<input type="checkbox" name="checkbox1" value="Dating" />Dating
<input type="checkbox" name="checkbox2" value="Serious Relationships" />Serious Relationships
<input type="checkbox" name="checkbox3" value="Friends" />Friends
<input type="checkbox" name="checkbox4" value="Networking" /> NetworkingI am using this variable::::::::::;[/syntax]
Code: Select all
$checkbox1=$_POST['checkbox1'];//varible for dating
$checkbox2=$_POST['checkbox2'];//varible for serious ralationship
$checkbox3=$_POST['checkbox3'];//varible for friends
$checkbox4=$_POST['checkbox4'];//varible for networking
$final=$checkbox1.",".$checkbox1.",".$checkbox1.",".$checkbox1;
$qry_ins="update register_dtl set gender='$gender',dob='$dob',occupation='$occupation',city='$city',country='$country',region='$region',postal_code='$postalcode',ethnicity='$ethnicity',bodytype= '$bodytype',height='$height',i_am_here_for='$final' where uname='".$_SESSION['username']."'";
$rs_ins=mysql_query($qry_ins) or die("error:". mysql_error());Thanks & Regards
Ranjan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]