Edit file File name : recipe-addf.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); include("../include/simpleimage.php"); validate_admin(); if($_REQUEST['submitForm']=='yes'){ $title = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['title']); $about = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['about']); $tags = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['tags']); $pname_count = count($_REQUEST['pname']); $step_count = count($_REQUEST['step']); $nutrition_name_count = count($_REQUEST['nutrition_name']); $ps_count = count($_REQUEST['psearch']); $variation = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['variation']); $serve_qty = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['serve_qty']); $prep = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['prep']); $cooking = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['cooking']); $course = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['course']); $category = mysqli_real_escape_string($GLOBALS['conn'],$_REQUEST['category']); $veg =$_REQUEST['veg']; $veg_array = implode(',', $veg); $veg_array = mysqli_real_escape_string($GLOBALS['conn'],$veg_array); $prep_method =$_REQUEST['prep_method']; $prep_array = implode(',', $prep_method); $add_array = mysqli_real_escape_string($GLOBALS['conn'],$prep_array); $recipe =$_REQUEST['recipe']; $holiday_array = implode(',', $recipe); $add_array = mysqli_real_escape_string($GLOBALS['conn'],$holiday_array); $add =$_REQUEST['add']; $add_array = implode(',', $add); $add_array = mysqli_real_escape_string($GLOBALS['conn'],$add_array); $health_benifits = mysqli_real_escape_string($GLOBALS['conn'],trim($_POST['health_benifits'])); $recipe_notes = mysqli_real_escape_string($GLOBALS['conn'],trim($_POST['recipe_notes'])); $pre_cooking_tips = mysqli_real_escape_string($GLOBALS['conn'],trim($_POST['pre_cooking_tips'])); $nutrition = mysqli_real_escape_string($GLOBALS['conn'],trim($_POST['nutrition'])); $url=SITE_URL; if($url == DEVSITE_URL) { $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection"); // the FTP server you want to connect to. $login_status = ftp_login($conn_id, "devpuneet@dev.goquicklly.com", "*dyMZIYm[[PT") or die("Error in FTP login"); // Login to the FTP server. } else if($url == UATSITE_URL) { $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection"); // the FTP server you want to connect to. $login_status = ftp_login($conn_id, "devgoquicklly", "7ZcS58nmn_MH31") or die("Error in FTP login"); // Login to the FTP server. } else if($url == MAINSITE_URL) { $conn_id = ftp_connect("3.133.214.148") or die("Error in FTP connection"); // the FTP server you want to connect to. $login_status = ftp_login($conn_id, "mainuser@quicklly.com", "n3At8hv3LZKCiF6") or die("Error in FTP login"); // Login to the FTP server. } if($_FILES['photo']['size']>0 && $_FILES['photo']['error']==''){ $photo=time().substr($_FILES['photo']['name'],-5); $target_file = $_FILES['photo']['tmp_name']; $destination_file = "images/chef/".$photo; $upload_status = ftp_put($conn_id, $destination_file, $target_file, FTP_BINARY); if (!$upload_status) { $photo = ''; } //move_uploaded_file($_FILES['photo']['tmp_name'], WEBSITE_SITE_URL."images/chef/".$photo); } if($_FILES['video']['size']>0 && $_FILES['video']['error']==''){ $video=time().substr($_FILES['video']['name'],-5); $target_file = $_FILES['video']['tmp_name']; $destination_file = "upload_images/chef/video/".$video; $upload_status = ftp_put($conn_id, $destination_file, $target_file, FTP_BINARY); if (!$upload_status) { $video = ''; } //move_uploaded_file($_FILES['video']['tmp_name'], WEBSITE_SITE_URL."upload_images/chef/video/".$video); } if($_REQUEST['id']==''){ // $obj->query("insert into $tbl_recipe set name='$name', url='$url',image='$photo' ,brand='$brand'"); // $_SESSION['sess_msg']='Press Release added successfully'; }else{ $sql="UPDATE `tbl_recipe` SET `recipe_name`='$title',`category`='$category', `description`='$about',`tags`='$tags',`veg_non_veg`='$veg_array',`variation`='$variation', `serve_qty`='$serve_qty',`prepretion_time`='$prep',`cooking_time`='$cooking',`recipe_type`='$course', `pre_method`='$prep_array',`holiday_special`= '$holiday_array',`additional_note`='$add_array', health_benifits = '$health_benifits', recipe_notes = '$recipe_notes', pre_cooking_tips = '$pre_cooking_tips', nutrition = '$nutrition' "; // echo $sql; // exit; if(isset($photo)){ $imageArr=$obj->query("select photo from tbl_recipe where id='".$_REQUEST['id']."' "); $resultImage=$obj->fetchNextObject($imageArr); @unlink(WEBSITE_SITE_URL."images/chef/".$resultImage->photo); $sql.=" ,photo='$photo' "; } if(isset($video)){ $videoArr=$obj->query("select video from tbl_recipe where id='".$_REQUEST['id']."' "); $resultVideo=$obj->fetchNextObject($videoArr); @unlink(WEBSITE_SITE_URL."upload_images/chef/video/".$resultImage->video); $sql.=" ,video='$video' "; } $sql.=" where id='".$_REQUEST['id']."'"; $obj->query($sql); $sqldelS = $obj->query("DELETE FROM `tbl_recipe_step` WHERE recipe_id ='".$_REQUEST['id']."'"); if($step_count > 0) { for($i=0; $i<$step_count; $i++) { if(trim($_POST["step"][$i] != '')) { $step = $_POST["step"][$i]; $step_image = ''; if($_FILES['step_image']['size'][$i]>0 && $_FILES['step_image']['error'][$i]==''){ $step_image = time().substr($_FILES['step_image']['name'][$i],-5); $target_file = $_FILES['step_image']['tmp_name'][$i]; $destination_file = "upload_images/chef/step/".$step_image; $upload_status = ftp_put($conn_id, $destination_file, $target_file, FTP_BINARY); if (!$upload_status) { $step_image = ''; } //move_uploaded_file($_FILES['step_image']['tmp_name'][$i], WEBSITE_SITE_URL."upload_images/chef/step/".$step_image); } else if(!empty($_POST['step_image_old'][$i])){ $step_image = $_POST['step_image_old'][$i]; } $sql = $obj->query("INSERT INTO `tbl_recipe_step`(`recipe_id`, `step`, step_image) VALUES ('".$_REQUEST['id']."','$step', '$step_image')"); } } } // $sqldelI = $obj->query("DELETE FROM `tbl_recipe_ingredients` WHERE recipe_id ='".$_REQUEST['id']."'"); // $sqldelS = $obj->query("DELETE FROM `tbl_recipe_map_products` WHERE recipe_id ='".$_REQUEST['id']."'"); if ($pname_count > 0) { for ($j=0; $j < $pname_count; $j++) { $pname = $_POST["pname"][$j]; $qty_p = $_POST["qty_p"][$j]; $qtype = $_POST["qtype"][$j]; $product_id = $_POST["q_id"][$j]; $ingredient_id = $_POST["ingredient_id"][$j]; // $sql = $obj->query("INSERT INTO `tbl_recipe_ingredients`(`recipe_id`, `product_id`,`product_name`, `qty`, `qty_type`) // VALUES ('".$_REQUEST['id']."', '$product_id','$pname','$qty_p','$qtype')"); // $ingredients_id=$obj->lastInsertedId(); $checkdata=$obj->query("select * from tbl_recipe_ingredients where product_name='".$pname."' and recipe_id='".$_REQUEST['id']."'"); $row=$obj->fetchNextObject($checkdata); if($row->product_name==$pname) { $sql = $obj->query("UPDATE `tbl_recipe_ingredients` SET `recipe_id`='".$_REQUEST['id']."', `product_id`='$product_id',`product_name`= '$pname',`qty`='$qty_p',`qty_type`='$qtype' WHERE id='".$ingredient_id."'"); } else { $sql = $obj->query("INSERT INTO `tbl_recipe_ingredients`(`recipe_id`, `product_id`,`product_name`, `qty`, `qty_type`) VALUES ('".$_REQUEST['id']."', '$product_id','$pname','$qty_p','$qtype')"); } $psearch = $_POST["psearch"][$j]; $pids = $_POST["pids"][$j]; $map_id = $_POST["map_id"][$j]; if($map_id == ''){ $sql = $obj->query("INSERT INTO `tbl_recipe_map_products`(`recipe_id`,`ingredients_id`, `product_id`,`product_name`) VALUES ('".$_REQUEST['id']."','".$ingredient_id."','$pids','$psearch')"); }else{ $sql = $obj->query("UPDATE `tbl_recipe_map_products` SET `recipe_id`='".$_REQUEST['id']."', `ingredients_id`='".$ingredient_id."',`product_id`= '$pids',`product_name`='$psearch' WHERE id='".$map_id."'"); } } } $obj->query("delete from tbl_recipe_nutrition where recipe_id='" . $_REQUEST['id'] . "'"); if ($nutrition_name_count >= 0) { for ($k = 0; $k < $nutrition_name_count; $k++) { $nutrition_value = $_POST["nutrition_value"][$k]; $nutrition_name = $_POST["nutrition_name"][$k]; $checkdata = $obj->query("select * from tbl_recipe_nutrition where nutrition_name='" . $nutrition_name . "' and recipe_id='" . $_REQUEST['id'] . "'"); $row = $obj->fetchNextObject($checkdata); $sql = $obj->query("INSERT INTO `tbl_recipe_nutrition`(`recipe_id`, `nutrition_name`,`nutrition_value`) VALUES ('" . $_REQUEST['id'] . "', '$nutrition_name','$nutrition_value')"); } } $_SESSION['sess_msg']='Recipe updated successfully'; } header("location:recipe-list.php"); exit(); } if($_REQUEST['id']!=''){ $sql=$obj->query("select * from tbl_recipe where id=".$_REQUEST['id']); $result=$obj->fetchNextObject($sql); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo SITE_TITLE; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/admin.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="javascript"> function validate(obj) { if(obj.name.value==''){ alert("Please enter Heading"); obj.name.focus(); return false; } if(obj.url.value==''){ alert("Please enter url"); obj.url.focus(); return false; } } </script> <script type="text/javascript" src="../include/ckeditor/ckeditor.js"></script> </head> <body> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <?php include("header.php") ?> <tr> <td align="right" class="paddRtLt70" valign="top"> <table width="99%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="middle" class="headingbg bodr text14"> <em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin:<?php if($_REQUEST['id']==''){?> Add<?php } else{?>Update<?php } ?> Recipe <span style="float:right; padding-right:10px;"> <input type="button" name="add" value="View Recipe List" class="button" onclick="location.href='recipe-list.php'" /></span></td> </tr> <tr> <td height="100" align="left" valign="top" bgcolor="#f3f4f6" class="bodr"> <form name="frm" method="POST" enctype="multipart/form-data" action="" onsubmit="return validate(this)"> <input type="hidden" name="submitForm" value="yes" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" /> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td align="center" colspan="2" class="paddRt14 paddBot11"> <font color="#FF0000"><strong><?php echo $_SESSION['sess_msg']; $_SESSION['sess_msg']='';?></strong></font></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Recipe Title</strong></td> <td align="left" class="paddBot11"> <input type="text" name="title" size="150" value="<?php echo stripslashes($result->recipe_name);?>"> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Tell us about your recipe</strong></td> <td align="left" class="paddBot11"> <textarea name="about" id="" class="ckeditor" cols="30" rows="10" placeholder="what do you love about this recipe?" required><?php echo stripslashes($result->description);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Select Category</strong></td> <td align="left" class="paddBot11"> <select name="category" id="category" class="form-control" required> <option value="">Select Category </option> <?php $sql3=$obj->query("SELECT * FROM `tbl_maincategory` where `parent_id`='4656'"); $reccnt3=$obj->numRows($sql3); while($row=$obj->fetchNextObject($sql3)){ ?> <option value="<?php echo $row->id;?>" <?php if($result->category==$row->id){?>selected<?php } ?>><?php echo $row->maincategory; ?></option> <?php } ?> </select> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Tags</strong></td> <td align="left" class="paddBot11"> <textarea name="tags" data-role="tagsinput" id="" class="form-control" cols="30" rows="10" required><?php echo stripslashes($result->tags);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> INGREDIENTS</strong></td> <td align="left" class="paddBot11"> <?php $sql3=$obj->query("SELECT * FROM `tbl_recipe_ingredients` where `recipe_id`='".$_REQUEST['id']."'"); $reccnt3=$obj->numRows($sql3); $w=1; while($row=$obj->fetchNextObject($sql3)) {?> <div style="margin-bottom:10px;" id="<?php echo $row->product_id;?>"> <label for="">INGREDIENTS <?php echo $w; ?></label><br/> <div class="marchadd" id="marchadd<?php echo $row->product_id;?>"> <input type="hidden" name="ingredient_id[]" value="<?php echo $row->id;?>"> <input size="30" type="text" name="pname[]" class="srchAdda" id="search-box<?php echo $row->product_id;?>" value="<?php echo stripslashes($row->product_name);?>"> <input type="hidden" name="q_id[]" class="srcAdd" value="<?php echo stripslashes($row->product_id);?>"> <input size="30" type="text" name="qty_p[]" value="<?php echo stripslashes($row->qty);?>"> <select name="qtype[]" class="form-control"> <option value=''> Select</option> <option value="Bag" <?php if($row->qty_type=='Bag'){?>selected<?php }?>>BAG</option> <option value="Bunch" <?php if($row->qty_type=='Bunch'){?>selected<?php }?>>Bunch</option> <option value="Case" <?php if($row->qty_type=='Case'){?>selected<?php }?>>Case</option> <option value="Count" <?php if($row->qty_type=='Count'){?>selected<?php }?>>Count</option> <option value="Dozen" <?php if($row->qty_type=='Dozen'){?>selected<?php }?>>Dozen</option> <option value="Each" <?php if($row->qty_type=='Each'){?>selected<?php }?>>Each</option> <option value="Floz" <?php if($row->qty_type=='Floz'){?>selected<?php }?>>FLOZ</option> <option value="Gallon" <?php if($row->qty_type=='Gallon'){?>selected<?php }?>>Gallon</option> <option value="Gm" <?php if($row->qty_type=='Gm'){?>selected<?php }?>>GM</option> <option value="Kg" <?php if($row->qty_type=='Kg'){?>selected<?php }?>>KG</option> <option value="Lbs" <?php if($row->qty_type=='Lbs'){?>selected<?php }?>>LBS</option> <option value="Ltr" <?php if($row->qty_type=='Ltr'){?>selected<?php }?>>LTR</option> <option value="Ml" <?php if($row->qty_type=='Ml'){?>selected<?php }?>>ML</option> <option value="Oz" <?php if($row->qty_type=='Oz'){?>selected<?php }?>>OZ</option> <option value="Packs" <?php if($row->qty_type=='Packs'){?>selected<?php }?>>PACKS</option> <option value="Pcs" <?php if($row->qty_type=='Pcs'){?>selected<?php }?>>PCS</option> <option value="Portion" <?php if($row->qty_type=='Portion'){?>selected<?php }?>>Portion</option> <option value="Cup" <?php if($row->qty_type=='Cup'){?>selected<?php }?>> Cup </option> <option value="Tablespoons" <?php if($row->qty_type=='Tablespoons'){?>selected<?php }?>> Tablespoons</option> </select> </div> <br> <?php $sql14=$obj->query("SELECT * FROM `tbl_recipe_map_products` where `recipe_id`='".$_REQUEST['id']."' and ingredients_id = '$row->id'"); $reccnt14=$obj->numRows($sql14); $row14=$obj->fetchNextObject($sql14); ?> <label for="">Map Products <?php echo $w; ?></label><br/> <div class="parentSearch"> <input size="30" type="text" name="psearch[]" class="srchAdd" value="<?php echo $row14->product_name;?>"> <div class="fresult"></div> <input type="hidden" class="idSave" name="pids[]" value="<?php echo $row14->product_id;?>"> <input type="hidden" name="map_id[]" value="<?php echo $row14->id;?>"> </div> </div> <?php $w++; }?> </tr> <tr > <td></td> <td id="ingredients"></td> </tr> <tr> <td></td> <td><button type="button" id="btnaddinge">Add More</button></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Steps</strong></td> <td align="left" class="paddBot11"> <table border=0 cellspacing=0 cellpadding=0> <?php $sql5=$obj->query("SELECT * FROM `tbl_recipe_step` where `recipe_id`='".$_REQUEST['id']."'"); $reccnt5=$obj->numRows($sql5); $w= 1; while($row=$obj->fetchNextObject($sql5)) {?> <tr><td id="step_<?=$row->id;?>"><label for="">Step <?php echo $w;?> <a href="javascript:void(0)" onclick="remove_step('<?=$row->id;?>')" style="color:red;">Remove</a></label> <input type="text" name="step[]" placeholder="Enter Steps" class="form-control name_list" size='150' value="<?php echo $row->step;?>" required/> </td> <td width="25%"><input type="file" name="step_image[]" class="form-control"> <input type="hidden" name="step_image_old[]" id="step_image_old_<?=$row->id;?>" value="<?php echo (!empty($row->step_image) ? $row->step_image : '');?>"> <?php //if(is_file(WEBSITE_SITE_URL."upload_images/chef/step/".$row->step_image)) {?> <?php if(!empty($row->step_image)) {?> <div id="image_<?=$row->id;?>"><img src="<?=WEBSITE_SITE_URL?>upload_images/chef/step/<?php echo $row->step_image; ?>" width="50" height="50" /> <a href="javascript:void(0)" onclick="remove_image('<?=$row->id;?>')" style="">Remove</a></div> <?php } ?> </td> </tr> <?php $w++; }?> <tr> <td id="TextBoxContainer"><strong></strong></td> </tr> <tr> <td> <button type="button" id="btnAdd">Add More</button> </td> </tr> </table> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Recipe Tips or variations</strong></td> <td align="left" class="paddBot11"> <textarea name="variation" class="ckeditor" cols="30" rows="10" placeholder="share other way" required> <?php echo stripslashes($result->variation);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Share a photo of your recipe</strong></td> <td align="left" class="paddBot11"> <input type="file" name="photo" class="form-control"/> <?php //if(is_file(WEBSITE_SITE_URL."images/chef/".$result->photo)) {?> <?php if(!empty($result->photo)) {?> <img src="<?=WEBSITE_SITE_URL?>images/chef/<?php echo $result->photo; ?>" width="50" height="50" /> <?php } ?> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Share a video of your recipe</strong></td> <td align="left" class="paddBot11"> <input type="file" name="video" id="video" class="form-control"/> <?php //if(file_exists(WEBSITE_SITE_URL."upload_images/chef/video/".$result->video)) {?> <?php if(!empty($result->video)) {?> <div id="video_<?=$result->id?>"></div><video width="150px" height="auto" controls> <source src="<?=WEBSITE_SITE_URL?>upload_images/chef/video/<?php echo $result->video; ?>" type="video/mp4"> </video> <a href="javascript:void(0)" onclick="remove_video('<?=$row->id;?>', 'step_image')" style="">Remove</a></div> <?php } ?> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Quantity serve</strong></td> <td align="left" class="paddBot11"> <select name="serve_qty" id="serve_qty" class="form-control" required> <option value="1" <?php if($result->serve_qty==1){?>selected<?php }?>>1</option> <option value="2" <?php if($result->serve_qty==2){?>selected<?php }?>>2</option> <option value="3" <?php if($result->serve_qty==3){?>selected<?php }?>>3</option> <option value="4" <?php if($result->serve_qty==4){?>selected<?php }?>>4</option> <option value="5" <?php if($result->serve_qty==5){?>selected<?php }?>>5</option> <option value="6" <?php if($result->serve_qty==6){?>selected<?php }?>>6</option> <option value="7" <?php if($result->serve_qty==7){?>selected<?php }?>>7</option> <option value="8" <?php if($result->serve_qty==8){?>selected<?php }?>>8</option> <option value="9" <?php if($result->serve_qty==9){?>selected<?php }?>>9</option> <option value="10" <?php if($result->serve_qty==10){?>selected<?php }?>>10</option> </select> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> prepration time</strong></td> <td align="left" class="paddBot11"> <input type="time" name="prep" id="prep" class="form-control" value="<?php echo stripslashes($result->prepretion_time);?>" required> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Cooking time</strong></td> <td align="left" class="paddBot11"> <input type="time" name="cooking" id="cooking" class="form-control" value="<?php echo stripslashes($result->cooking_time);?>" required> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Choose Your Recipe's</strong></td> <td align="left" class="paddBot11"> <select name="course" id="course" class="form-control" required> <option value="">Select Course </option> <?php $sql5=$obj->query("SELECT * from tbl_chef_course where status='1' order by id DESC"); $reccnt5=$obj->numRows($sql5); while($row=$obj->fetchNextObject($sql5)) { $id = $row->id; ?> <option value="<?php echo $id;?>" <?php if($result->recipe_type==$id){?>selected<?php }?>><?php echo $row->name; ?></option> <?php }?> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Veg/ Non Veg</strong></td> <td align="left" class="paddBot11 nextrow"> <p><input class="form-check-input" type="radio" name="veg[]" value="1" <?php if($result->veg_non_veg==1) { ?> checked="checked" <?php } ?>> Veg</p> <p><input class="form-check-input" type="radio" name="veg[]" value="0" <?php if($result->veg_non_veg==0) { ?> checked="checked" <?php } ?>> Non Veg</p> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong> Health Benefits Of The Recipe</strong></td> <td align="left" class="paddBot11"> <textarea name="health_benifits" id="health_benifits" class="ckeditor" cols="30" rows="10" placeholder="What are the health benefits of the recipe?" > <?php echo stripslashes($result->health_benifits);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Notes For Recipe</strong></td> <td align="left" class="paddBot11"> <textarea name="recipe_notes" id="recipe_notes" class="ckeditor" cols="30" rows="10" placeholder="Enter recipe notes" > <?php echo stripslashes($result->recipe_notes);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Pro Cooking Tips For Recipe</strong></td> <td align="left" class="paddBot11"> <textarea name="pre_cooking_tips" id="pre_cooking_tips" class="ckeditor" cols="30" rows="10" placeholder="Enter pro cooking tips for recipe" > <?php echo stripslashes($result->pre_cooking_tips);?></textarea> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Nutrition</strong></td> <td align="left" class="paddBot11"> <textarea name="nutrition" id="nutrition" class="ckeditor" cols="30" rows="10" placeholder="Enter nutrition for recipe"> <?php echo stripslashes($result->nutrition); ?></textarea> </tr> <tr> <td> </td> <td align="left" class="paddBot11 paddRt14"><strong>Nutrition Type List</strong></td> <td> <?php $sqlnutrition = $obj->query("SELECT * FROM `tbl_recipe_nutrition` where `recipe_id`='" . $_REQUEST['id'] . "'"); $recentnutrition = $obj->numRows($sqlnutrition); $w = 1; while ($row = $obj->fetchNextObject($sqlnutrition)) { ?> <tr> <td></td> <td align="left" class="paddBot11"><input type="text" name="nutrition_name[]" placeholder="" class="form-control" size="10" value="<?php echo $row->nutrition_name ?>"> : <input type="text" name="nutrition_value[]" placeholder="" class="form-control" size="10" value="<?php echo $row->nutrition_value ?>"><button type="button" class="remove" style="background:none; border:none; cursor:pointer"><img src="images/remove.png" style="width:25px;"></button></td> </tr> <?php $w++; } ?> </td> </tr> <tr> <td></td> <td id="TextBoxNutrition"></td> </tr> <tr> <td></td> <td><button type="button" id="btnAddNutrition">Add Nutrition Type</button></td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Choose Your Recipes Prep Methodp <p>(Select all that apply)</p></strong></td> <td align="left" class="paddBot11 nextrow"> <?php $r= explode(',',$result->pre_method); $sql5=$obj->query("SELECT * from tbl_chef_prep where status='1'"); $reccnt5=$obj->numRows($sql5); while($row=$obj->fetchNextObject($sql5)) { $id = $row->id; ?> <p><input class="form-check-input" type="checkbox" name="prep_method[]" value="<?php echo $id;?>" <?php if(in_array($id,$r)){ echo 'checked';}?>> <?php echo $row->name;?></p> <?php }?> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Choose A Holiday for your recipe <p>(Select all that apply)</p></strong></td> <td align="left" class="paddBot11 nextrow"> <?php $r= explode(',',$result->holiday_special); $sql5=$obj->query("SELECT * from tbl_chef_holiday where status='1'"); $reccnt5=$obj->numRows($sql5); while($row=$obj->fetchNextObject($sql5)) { $id = $row->id; ?> <p><input class="form-check-input" type="checkbox" name="recipe[]" value="<?php echo $id;?>" <?php if(in_array($id,$r)){ echo 'checked';}?>> <?php echo $row->name;?></p> <?php }?> </td> </tr> <tr> <td align="right" class="paddBot11 paddRt14"><strong>Choose Additionl lable for your recipe <p>(Select all that apply)</p></strong></td> <td align="left" class="paddBot11 nextrow"> <?php $r= explode(',',$result->additional_note); $sql5=$obj->query("SELECT * from tbl_chef_additional where status='1'"); $reccnt5=$obj->numRows($sql5); while($row=$obj->fetchNextObject($sql5)) { $id = $row->id; ?> <p><input class="form-check-input" type="checkbox" name="add[]" value="<?php echo $id;?>" <?php if(in_array($id,$r)){ echo 'checked';}?>> <?php echo $row->name;?></p> <?php }?> </td> </tr> <tr> <td align="right" class="paddRt14 paddBot11"> </td> <td align="left" class="paddBot11"> </td> </tr> <tr> <td width="18%" align="right" class="paddRt14 paddBot11"> </td> <td width="82%" align="left" class="paddBot11"> <input type="submit" name="submit" value="Submit" class="submit" border="0"/> <input name="Reset" type="reset" id="Reset" value="Reset" class="submit" border="0" /> </td> </tr> </table></form> </td> </tr> </table> </td> </tr> </table> </td> </tr> <?php include('footer.php'); ?> </table> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-tagsinput/1.3.6/jquery.tagsinput.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/js/bootstrap-select.min.js"></script> <style> .marchadd { display: flex; position: relative; } .marchadd input[type="text"] ,.marchadd select.form-control { width: 25%; padding: 5px; margin: 5px; } .fresult { position: absolute; display: block; background: #fff; z-index: 999; } input.saveBtn { display: block; position: relative; padding: 5px; } .parentSearch input { padding: 5px } input.srchAdd{ width:70%; } .parentSearch { border-bottom: 2px solid; padding-bottom: 9px; } td.paddBot11.nextrow { display: flex; flex-wrap: wrap; } td.paddBot11.nextrow p { width: 16%; } </style> <script> $('#input-tags').tagsInput({ }); </script> <script> function remove_image(curid) { if(confirm('Are you sure to remove this step image.')) { $.ajax({ type: "POST", url: "remove_step_image.php", data: {curid: curid, type:'stepiamge'}, success: function(data){ $("#image_"+curid).html(''); $("#step_image_old_"+curid).val(''); } }); } } function remove_video(curid) { if(confirm('Are you sure to remove recipe video.')) { $.ajax({ type: "POST", url: "remove_step_image.php", data: {curid: curid, type:'video'}, success: function(data){ $("#video_"+curid).html(''); } }); } } function remove_step(curid) { if(confirm('Are you sure to remove this step.')) { $.ajax({ type: "POST", url: "remove_step_image.php", data: {curid: curid, type:'step'}, success: function(data){ $("#step_"+curid).html(''); } }); } } $( ".srchAdd" ).keyup(function() { var search = $(this).val(); var ele= $(this).siblings('.fresult'); var eles= $(this).siblings('.idSave'); var mele = $(this); var filter=''; var name=''; $.ajax({ type: "POST", url: "search_product.php", data: {keyword: search}, success: function(data){ ele.show(); ele.html(data); ele.find('.saveBtn').click( function() { filter = jQuery.map($(':checkbox[name=multi\\[\\]]:checked'), function (n, i) { return n.value; }).join(','); eles.val(filter); name = jQuery(':checkbox[name=multi\\[\\]]:checked').map(function() { return jQuery(this).data('name'); }).get(); mele.val(name); ele.hide(); ele.html(''); }) } }); }); $("#btnAdd").bind("click", function () { var div = $("<tr/>"); div.html(GetDynamicTextBox()); $("#TextBoxContainer").append(div); }); $("#btnAddNutrition").bind("click", function() { var div = $("<tr/>"); div.html(GetDynamicTextBoxNutrition()); $("#TextBoxNutrition").append(div); }); $("body").on("click", ".remove", function() { $(this).closest("tr").remove(); }); var x = 1; function GetDynamicTextBox() { var x = $('#TextBoxContainer .srchAdd').length; x = x + 1; var srchId ='search-box'+x; return '<td>Step <input type="text" name="step[]" id="'+srchId+'" class="form-controls srchAdd" required style="width:320px" autocomplete="off"/><input type="file" name="step_image[]" ><input name ="q_id[]" type="hidden" class="form-control srcAdd"/></td>'+'<td><button type="button" class="remove" style="background:none; border:none; cursor:pointer"><img src="images/remove.png" style="width:25px;"></button></td>' } function GetDynamicTextBoxNutrition() { var x = $('#TextBoxNutrition .srchAdd').length; x = x + 1; var srchId = 'search-box' + x; return '<tr><td></td><td align="left" class="paddBot11"><input type="text" name="nutrition_name[]" placeholder="" class="form-control" size="10" value=""> : <input type="text" name="nutrition_value[]" placeholder="" class="form-control" size="10" value=""><button type="button" class="remove" style="background:none; border:none; cursor:pointer"><img src="images/remove.png" style="width:25px;"></button></td></tr>'; } $("#btnaddinge").bind("click", function() { var div = $("<tr/>"); div.html(getdynamic()); $("#ingredients").append(div); }); function getdynamic() { var x = $('#ingredients .srchAdd').length; x = x + 1; var srchId ='search-box'+x; return '<td align="left" class="paddBot11"><div style="margin-bottom:10px;" id="2377"><label for="">INGREDIENTS </label><br><div class="marchadd" id="marchadd2377"><input type="hidden" name="ingredient_id[]" value=""><input size="30" type="text" name="pname[]" class="srchAdd" id="search-box2377" value=""><input type="hidden" name="q_id[]" class="srcAdd" value=""><input size="30" type="text" name="qty_p[]" value=""><select name="qtype[]" class="form-control"><option> Select</option><option value="Kg"> Kg</option><option value="Grms"> Grms</option><option value="Cup"> Cup </option><option value="Tablespoons"> Tablespoons</option></select></div><br><label for="">Map Products 1</label><br><div class="parentSearch"><input size="30" type="text" name="psearch[]" class="srchAdd" value=""><div class="fresult" ></div><input type="hidden" name="map_id[]" value=""><button type="button" class="remove" style="background:none; border:none; cursor:pointer"><img src="images/remove.png" style="width:25px;"></button></div></div></td>' } </script> </body> </html> Save