?
Path : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/ |
Current File : /home/u949514618/domains/karmaasrconsultants.com/public_html/admin/addpostcontent.php |
<div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Add <small>Project</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-plus-square"></i> Home</a></li> <li class="active">Add Project</li> </ol> </section> <!-- Main content --> <section class="content"> <!-- Small boxes (Stat box) --> <?php if(isset($_POST['submit'])){ $date = time(); $title = mysqli_real_escape_string($con,$_POST['title']); $post_data = mysqli_real_escape_string($con,$_POST['post-data']); $categories = $_POST['categories']; $projecttype = $_POST['projecttype']; $address = mysqli_real_escape_string($con,$_POST['address']); $introadwidth = mysqli_real_escape_string($con,$_POST['introadwidth']); $status = $_POST['status']; $image = $_FILES['image']['name']; $tmp_name = $_FILES['image']['tmp_name']; $checkbox1=$_POST['amenity']; $chk=""; foreach($checkbox1 as $chk1) { $chk .= $chk1.","; } $usp=$_POST['usp']; $usize = mysqli_real_escape_string($con,$_POST['usize']); $rerastatus = $_POST['rerastatus']; $rerano = $_POST['rerano']; $maptype = $_POST['maptype']; $lmap = $_POST['lmap']; $lmapimg = $_FILES['lmapimg']['name']; $lmapimg_tmp = $_FILES['lmapimg']['tmp_name']; $fprice = $_POST['fprice']; $tprice = $_POST['tprice']; $fpricelbl = $_POST['fpricelbl']; $tpricelbl = $_POST['tpricelbl']; $websiteurl = $_POST['websiteurl']; $website = $_POST['website']; $havingdiscount = $_POST['havingdiscount']; $discount = mysqli_real_escape_string($con,$_POST['discount']); $featured = $_POST['featured']; $phimage = $_FILES['phimage']['name']; $headerimage_tmp = $_FILES['phimage']['tmp_name']; $pbrochure = $_FILES['pbrochure']['name']; $brochure_tmp = $_FILES['pbrochure']['tmp_name']; if(empty($title) or empty($post_data) or empty($image)){ $error = "All (*) Fields Are Required"; } else{ $insert_query = "insert into posts (date,title,address,phimage,image,categories,projecttype,introadwidth,post_data,amenities,usp,unitsize,rerastatus,rerano,maptype,lmap,lmapimg,fprice,tprice,fpricelbl,tpricelbl,websiteurl,website,featured,pbrochure,status,discount,discount_detail) values ('$date','$title','$address','$phimage','$image','$categories','$projecttype','$introadwidth','$post_data','$chk','$usp','$usize','$rerastatus','$rerano','$maptype','$lmap','$lmapimg','$fprice','$tprice','$fpricelbl','$tpricelbl','$websiteurl','$website','$featured','$pbrochure','$status','$havingdiscount','$discount')"; if(mysqli_query($con, $insert_query)){ $msg = "Post Has been Added"; move_uploaded_file($tmp_name, "../img/project/$image"); move_uploaded_file($lmapimg_tmp, "../img/locationmap/$lmapimg"); move_uploaded_file($headerimage_tmp, "../img/header/$phimage"); move_uploaded_file($brochure_tmp, "../img/brochure/$pbrochure"); header('Location: posts.php'); } else{ $error = "Post Has Not been added"; } } } ?> <div class="row"> <div class="col-xs-12"> <form action="" method="Post" enctype="multipart/form-data"> <div class="form-group"> <label for="title">Title*</label> <?php if(isset($msg)){ echo "<span class='pull-right' style='color: green;'>$msg</span>"; } else if(isset($error)){ echo "<span class='pull-right' style='color: red;'>$error</span>"; } ?> <input type="text" name="title" value="<?php if(isset($title)){echo $title;} ?>" placeholder="Type Project Title Here" class="form-control"> </div> <!--<div class="form-group"> <a href="media.php" class="btn btn-primary">Add Media</a> </div>--> <div class="form-group"> <textarea name="post-data" id="post-data" rows="10" class="form-control"><?php if(isset($post_data)){echo $post_data;} ?></textarea> </div> <div class="row"> <div class="col-sm-4"> <label for="file">Project Image*</label> <input type="file" name="image" class="form-control" accept=".jpg, .png, .gif"> <small>Size Shoul Be 500x397</small> </div> <div class="col-sm-4"> <label for="title">Project Type*</label> <select class="form-control" name="projecttype" id="projecttype"> <?php $type_query = "select * from projecttype order by id asc"; $type_run = mysqli_query($con, $type_query); if(mysqli_num_rows($type_run) > 0){ while ($type_row = mysqli_fetch_array($type_run)) { $type_name = $type_row['category']; echo "<option value='".$type_name."' ".((isset($projecttype) and $projecttype == $type_name)?"selected":"").">".ucfirst($type_name)."</option>"; # code... } } else{ echo "<center><h6>No Category Available</h6></center>"; } ?> </select> </div> <div class="col-sm-4"> <label for="title">Project Category*</label> <select class="form-control" name="categories" id="categories"> <?php $cat_query = "select * from categories order by id asc"; $cat_run = mysqli_query($con, $cat_query); if(mysqli_num_rows($cat_run) > 0){ while ($cat_row = mysqli_fetch_array($cat_run)) { $cat_name = $cat_row['category']; echo "<option value='".$cat_name."' ".((isset($categories) and $categories == $cat_name)?"selected":"").">".ucfirst($cat_name)."</option>"; # code... } } else{ echo "<center><h6>No Category Available</h6></center>"; } ?> </select> </div> </div> <div class="row"> <div class="col-sm-6"> <label for="address">Address*</label> <input type="text" name="address" value="<?php if(isset($address)){echo $address;} ?>" class="form-control" placeholder="Enter Address Here"> </div> <div class="col-sm-6"> <label for="introadwidth">Internal Road Width*</label> <input type="text" name="introadwidth" value="<?php if(isset($introadwidth)){echo $introadwidth;} ?>" class="form-control" placeholder="Enter Internal Road Width"> <small>If Road Width not available Please write N/A.</small> </div> </div> <div class="row"> <div class="col-sm-6"> <h4>Amenities*</h4> <div class="box-body"> <div class="form-group"> <select class="form-control select2" multiple="multiple" data-placeholder="Select a Amenity" style="width: 100%;" id="amenity" name="amenity[]"> <?php $amenity_query = "select * from amenities order by id asc"; $amenity_run = mysqli_query($con, $amenity_query); if(mysqli_num_rows($amenity_run) > 0){ while ($amenity_row = mysqli_fetch_array($amenity_run)) { $amenity_name = $amenity_row['amenities']; $amenity_id = $amenity_row['id']; ?> <option value="<?php echo $amenity_id; ?>"><?php echo $amenity_name; ?></option> <?php } } else{ echo "<center><h6>No Amenity Available</h6></center>"; } ?> </select> </div> </div> </div> <div class="col-sm-6"> <h4>Major USP*</h4> <div class="box-body"> <div class="form-group"> <textarea class="form-control" id="usp" name="usp" rows="5"><?php if(isset($usp)){echo $usp;} ?></textarea> <small>Type Major USP with Comma (,) Example:abc,xyz</small> </div> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <label for="usize">Unit Size*</label> <input type="text" name="usize" value="<?php if(isset($usize)){echo $usize;} ?>" class="form-control" placeholder="Enter Unit Size"> </div> <div class="col-sm-6"> <label for="rerastatus">RERA Status*</label> <select class="form-control" name="rerastatus" id="rerastatus" onchange="rera_status()"> <option selected="selected">Select Any RERA Status</option> <option value="applied">Applied</option> <option value="approved">Approved</option> <option value="notapplied">Not Applied</option> </select> <input type="text" name="rerano" value="<?php if(isset($rerano)){echo $rerano;} ?>" class="form-control" placeholder="Enter RERA Number" style="display: none;" id="rerano"> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="row"> <div class="col-sm-8"> <label for="fprice">Price Range*</label> <input type="text" name="fprice" value="<?php if(isset($fprice)){echo $fprice;} ?>" class="form-control" placeholder="From (Starting Price)"> <input type="text" name="tprice" value="<?php if(isset($tprice)){echo $tprice;} ?>" class="form-control" placeholder="To (End Price)"> </div> <div class="col-sm-4"> <label for="fpricelbl">Price Label*</label> <select class="form-control" name="fpricelbl" id="fpricelbl"> <option selected value="Th">Thousand</option> <option value="L">Lakh</option> <option value="Cr">Crore</option> </select> <select class="form-control" name="tpricelbl" id="tpricelbl"> <option selected value="Th">Thousand</option> <option value="L">Lakh</option> <option value="Cr">Crore</option> </select> </div> </div> </div> <div class="col-sm-6"> <label for="maptype">Location Map*</label> <select class="form-control" name="maptype" id="maptype" onchange="map_type()"> <option selected="selected">Select Any One Map Type</option> <option value="igm">Image Type</option> <option value="mpa">Map Type</option> </select> <input type="text" name="lmap" value="<?php if(isset($lmap)){echo $lmap;} ?>" class="form-control" placeholder="Enter Map Embedded Code Here" id="lmap" style="display: none;"> <small class="lmap" style="display: none;"><s>iframe src="</s>https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d7196.418447435718!2d85.043427!3d25.597963!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x558b95196f7471bc!2sCapital+Centre!5e0!3m2!1sen!2sin!4v1563426618531!5m2!1sen!2sin<s>" width="600" height="450" frameborder="0" style="border:0" allowfullscreen</s></small> <input type="file" name="lmapimg" id="lmapimg" class="form-control" accept=".jpg, .png, .gif" style="display: none;"> </div> </div> <div class="row"> <div class="col-sm-6"> <label for="file">Project Header Image*</label> <input type="file" name="phimage" class="form-control" accept=".jpg, .png, .gif"> <small>Size Should Be 1600x400</small> </div> <div class="col-sm-6"> <label for="file">Project Brochure*</label> <input type="file" name="pbrochure" class="form-control" accept=".pdf"> <small>Only .pdf file</small> </div> </div> <div class="row"> <div class="col-sm-6"> <label for="websiteurl">Project Website Url</label> <select class="form-control" name="websiteurl" id="websiteurl" onchange="web_status()"> <option selected="selected">Select Any One Option</option> <option value="yes">Yes</option> <option value="no">No</option> </select> <input type="text" name="website" value="<?php if(isset($website)){echo $website;} ?>" class="form-control" placeholder="Enter Website Url" id="website" style="display: none;"> <small class="website" style="display: none;">Enter Website Url (With http:// or https://)</small> </div> <div class="col-sm-6"> <label for="havingdiscount">Project Having Discount</label> <select class="form-control" name="havingdiscount" id="havingdiscount" onchange="disc_status()"> <option selected="selected">Select Any One Option</option> <option value="yes">Yes</option> <option value="no">No</option> </select> <input type="text" name="discount" value="<?php if(isset($discount)){echo $discount;} ?>" class="form-control" placeholder="Enter discount detail" id="discount" style="display: none;"> </div> </div> <div class="row"> <div class="col-sm-6"> <label for="featured">Featured*</label> <select class="form-control" name="featured" id="featured"> <option value="yes">Yes</option> <option value="no">No</option> </select> </div> <div class="col-sm-6"> <label for="title">Status*</label> <select class="form-control" name="status" id="status"> <option value="published">Published</option> <option value="draft">Draft</option> </select> </div> </div> <div class="row"> <div class="col-xs-12"> <input type="submit" class="btn btn-primary" value="Add Post" name="submit"> </div> </div> </form> </div> <!-- ./col --> </div> <!-- /.row --> <!-- Main row --> <!-- /.row (main row) --> </section> <!-- /.content --> </div>