<?php include("../include/constr.php")?> <?php include("../include/function.php")?> <?php $txtdaydes=""; $pid=0; $action=""; $cnt=0; $txtdes=""; $showerror=""; if(isset($_REQUEST['ACTION'])) { //print_r($_REQUEST); $action=$_REQUEST['ACTION']; if($action=='UPDATE') { //echo operate($pid,$i); $cnt=$_REQUEST['cnt']; $pid=$_REQUEST['pid']; echo $pid."<br>"; echo $cnt; for($i=1;$i<=$cnt;$i++) { $txtdaydes =$_POST["txtdaydes".$i]; //echo "entered......"; $rs=mysqli_query($con,"select * from tbl_day where id=".$pid." and day_no=".$i." and status='YES'"); if(!$rs) { die("error".mysqli_error($con)); } if(mysqli_fetch_array($rs)) { //print_r($_REQUEST); echo "Hello".$pid; $rs=mysqli_query($con,"update tbl_day set description='".$txtdaydes."' where id=".$pid." and day_no=".$i.""); if(!$rs) { die("error in update".mysqli_error($con)); } else $showerror="Record Successfully Updated!<br/>"; } else { // print_r($_REQUEST); $rs=mysqli_query($con,"insert into tbl_day(id,day_no,description)values(".$pid.",".$i.",'".$txtdaydes."')"); if(!$rs) { die("error in insertion".mysqli_error($con)); } else $showerror="Record Successfully Inserted<br/>"; } }//end for } // end update action if($action=='Load') { $pid=$_REQUEST['selectpackage']; } $rs=mysqli_query($con,"select pack_name from tbl_package where id=".$pid.""); if(!$rs) { die("error".mysqli_error($con)); } $row=mysqli_fetch_array($rs); $pname=$row['pack_name']; //echo $pname; } ?> <form method="post" name="formdaydescription" id="formdaydescription" onSubmit="xmlhttpPost('./master/daydescription.php','formdaydescription','subdiv','Please Wait!');return false;"> <table class="tabledata" width="750px" border="1" height="auto" bgcolor="#CCCCCC" bordercolor="red" cellpadding="5" cellspacing="1"> <th class="stuinfo" colspan="9"> Day's Description For Package - <?php echo "<font color='#FFCCFF'>". $pname."</font>";?> <?php echo "<font color='red'>".$showerror."</font>"; ?> </th> <tr bgcolor="#FfffFF" height="30px" align=""> <!--<td hight="30"><font color="#333333">Package Id</font></td>--> <td width="74" hight="30"><font color="#333333">Sr. No.</font></td> <td width="647" hight="30"><font color="#333333">Description</font></td> </tr> <?php $count="select no_of_days from tbl_package where id=".$pid.""; $rs=mysqli_query($con,$count); if(!$rs) { die("error".mysqli_error($con)); } $row=mysqli_fetch_array($rs); $cnt=$row['no_of_days']; for($i=1;$i<=$cnt;$i++) { ?> <tr bgcolor="#F2FEFF" align=""> <!-- <td hight="60"><?php echo $pid;?></td>--> <td hight="60"><?php echo $i?></td> <td> <input type="hidden" name="hidid[]" id="hidid" value="<?php echo $i ?>" /> <textarea name="txtdaydes<?php echo $i?>" cols="20" placeholder="Description" ><?php echo operate($pid,$i); ?></textarea> </td> </tr> <?php }// end for ?> <tr bgcolor="#F2FEFF" align=""> <td hight="60" colspan="5" align="center"> <input type="submit" name="UPDATE" value="UPDATE"/> <input type="hidden" name="ACTION" id="ACTION" value="UPDATE"/> <input type="hidden" name="pid" value="<?php echo $pid;?>"/> <input type="hidden" name="cnt" value="<?php echo $cnt;?>"/> </td></tr> </table> </form>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)