starfish
10-22-2008, 02:15 AM
hi...
the problem i am facing is that
i want to insert a value for each check box if it is checked by the user...
doctor has to select the days that would be working for him/her using checkboxes
if he checks the checkbox for monday
an entry in "working_days" table would be inserted for this doctor
one method i applied and got success is to check the value using isset()
a part from code is given below
if(isset($_REQUEST['mon']))
{
if($this->chk_dup_workingday($doc_id,$_REQUEST['mon'])==0)
{
$ins="insert into working_day (doctor_id, day_id) values('$doc_id', '$_REQUEST[mon]')";
$mark=mysql_query($ins) or die("Couldn't Insert Working day : ".mysql_error());
if($mark)
{
?> <script>
alert("Inserted Monday as a Working Day!");
</script>
<?
}
}
}
the problem is to optimize the code i mean it is a lengthy code / method
is there any other method / concept .........to achieve this.....
since i have to put this code for each check box to make an entry for the checked one....
the problem i am facing is that
i want to insert a value for each check box if it is checked by the user...
doctor has to select the days that would be working for him/her using checkboxes
if he checks the checkbox for monday
an entry in "working_days" table would be inserted for this doctor
one method i applied and got success is to check the value using isset()
a part from code is given below
if(isset($_REQUEST['mon']))
{
if($this->chk_dup_workingday($doc_id,$_REQUEST['mon'])==0)
{
$ins="insert into working_day (doctor_id, day_id) values('$doc_id', '$_REQUEST[mon]')";
$mark=mysql_query($ins) or die("Couldn't Insert Working day : ".mysql_error());
if($mark)
{
?> <script>
alert("Inserted Monday as a Working Day!");
</script>
<?
}
}
}
the problem is to optimize the code i mean it is a lengthy code / method
is there any other method / concept .........to achieve this.....
since i have to put this code for each check box to make an entry for the checked one....