I have a problem, when I retrieve the value from the $_POST variable, the value taken is the last value printed.
<?php
foreach($mlbb as $s){
?>
<div class="col-lg-4 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3><?php echo $s->layanan."<br>".$s->harga." Poin" ?></h3>
</div>
<form action="<?php echo base_url(). 'mlbb/beli_aksi'; ?> " method="post" id="form-satuan" >
<input type="hidden" name="id" class="form-control" value="<?php echo $s->id;?>">
<input type="hidden" name="harga" class="form-control" value="<?php echo $s->harga;?>">
<input type="submit" class="btn btn-success" value="Beli">
</div>
</div>
<!-- ./col -->
<?php } ?>
Related
i want to pass parameter in action method because of i am not able to pass parameter in header.
<form name="mailinglist1" method="post" action="report1.php" >
in this form i am using download button to connect my report (html)
$st1= 3106530;
header('Location: report1.php?num='.$st1 );
full coding
<?php
include("config/config.php");
include("header.php");
if(isset($_POST['search'])){
$query1 = mysql_query("SELECT * from staff where staff_code=".$_POST['staff']);
$row = mysql_fetch_array($query1);
$query2=mysql_query("SELECT * from master_tab where
deo_code =".$_POST['staff']
);
$query3 =mysql_query("select * from staff_bankinfo where staff_code=".$_POST['staff']);
$row1 = mysql_fetch_array($query3);
}
else if(isset($_POST['contact']))
{
mysql_query("INSERT into staff_bankinfo (staff_code, bank_name,branch,ifsc,acno) values('$_POST[staf]', '$_POST[bank_name]','$_POST[branch]','$_POST[ifsc]','$_POST[acno]')") or die(mysql_error());
$msg= "Added";
}
else
{
//$sheet_no = 202565;
//header('Location: print_edit_mark_details.php?num='.$sheet_no);
header('Location: report1.php?num='.$_POST['staff']);
// echo "hai";
}
?>
<?php include("theme.php"); ?>
</div><!-- /.ace-settings-container -->
<form method="post" id="form_id" class="form-horizontal" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<td align="center" colspan="6">
<select name="staff" required>
<option value="">Select Staff</option>
<?php
//dropdwon list based on query1
<?php } ?>
</select>
</td>
<!--2 input item from_date and to_date -->
<label for="mindate">From<span class="important"></span></label>
<td align="center">
<input type="date" name="mindate" id="login_id" placeholder="st date" value="<?php echo isset($_POST['mindate']) ? $_POST['mindate'] : '' ?>" required> </td>
<label for="maxdate">To<span class="important"></span></label>
<td align="center"><input type="date" name="maxdate" id="login_id" placeholder="end date" value="<?php echo isset($_POST['maxdate']) ? $_POST['maxdate'] : '' ?>" required> </td>
<td align="center"><input name="search" type="submit" id="search" value="Submit" class="last btn btn-info"/></td>
<br />
<br />
</form>
<form name="mailinglist1" method="post" action="report1.php" >
<div class="row">
<div class="col-xs-12">
<div class="table-header">
Staff Details
</div>
<br />
<div class="form-group">
<!-- input item 1 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 2 fetched result from query1 -->
</div>
</div>
<div class="form-group">
<!-- input item 3 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 4 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 5 fetched result from query1 -->
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-12">
<div class="table-header">
Bank Details
</div>
<br />
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1">Bank Name
<span class="important"></span></label>
<div class="col-sm-9">
<!-- input item 1 fetched result from query3 -->
</div>
<div class="form-group">
<!-- input item 2 fetched result from query3 -->
</div>
</div>
<div class="form-group">
<!-- input item 3 fetched result from query3 -->
</div>
</div>
<div class="form-group">
<!-- input item 4 fetched result from query3 -->
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-12">
<div class="table-header">
listing
</div>
<!-- div.table-responsive -->
<!-- div.dataTables_borderWrap -->
<div>
<table id="dynamic-table" name="dynamic-table" class="table table-striped table-bordered table-hover">
<thead>
<!--table fetched values from query2 -->
</table>
</div>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div>
<br/>
<div align="center">
<input name="contact" type="submit" id="contact" value="Update" style="padding:5px" class="sendButton" disabled />
<input name="download" type="submit" id="download" value="Download PDF" style="padding:5px" class="btn btn-danger" />
</div>
</label>
</div>
</form>
</div><!-- /.main-content -->
<div class="footer">
<!-- footer -->
</div>
</div><!-- /.main-container -->
pdf downloaded but not getting $_GET('num') in report1.php . how to know whether parameter is passed or not. i attached full coding of my page.
You send form via POST method, your data will be sent by post.
Either change $_GET by $_POST or change the form method to GET.
Please try the code below, which will help you get the value in PHP file.
<?php
include("config/config.php");
include("header.php");
if(isset($_POST['search'])){
$query1 = mysql_query("SELECT * from staff where staff_code=".$_POST['staff']);
$row = mysql_fetch_array($query1);
$query2=mysql_query("SELECT * from master_tab where
deo_code =".$_POST['staff']
);
$query3 =mysql_query("select * from staff_bankinfo where staff_code=".$_POST['staff']);
$row1 = mysql_fetch_array($query3);
}
else if(isset($_POST['contact']))
{
mysql_query("INSERT into staff_bankinfo (staff_code, bank_name,branch,ifsc,acno) values('$_POST[staf]', '$_POST[bank_name]','$_POST[branch]','$_POST[ifsc]','$_POST[acno]')") or die(mysql_error());
$msg= "Added";
}
else
{
if ( isset($_POST['download']) && !empty($_POST['download']) ) {
$staff_id = $_POST['staff_id'];
if ($staff_id) {
header('Location: report1.php?num='.$staff_id);
}
}
}
?>
<?php include("theme.php"); ?>
</div><!-- /.ace-settings-container -->
<form method="post" id="form_id" class="form-horizontal" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<td align="center" colspan="6">
<select name="staff" required>
<option value="">Select Staff</option>
<?php
//dropdwon list based on query1
<?php } ?>
</select>
</td>
<!--2 input item from_date and to_date -->
<label for="mindate">From<span class="important"></span></label>
<td align="center">
<input type="date" name="mindate" id="login_id" placeholder="st date" value="<?php echo isset($_POST['mindate']) ? $_POST['mindate'] : '' ?>" required> </td>
<label for="maxdate">To<span class="important"></span></label>
<td align="center"><input type="date" name="maxdate" id="login_id" placeholder="end date" value="<?php echo isset($_POST['maxdate']) ? $_POST['maxdate'] : '' ?>" required> </td>
<td align="center"><input name="search" type="submit" id="search" value="Submit" class="last btn btn-info"/></td>
<br />
<br />
</form>
<form name="mailinglist1" method="post" action="report1.php" >
<div class="row">
<div class="col-xs-12">
<div class="table-header">
Staff Details
</div>
<br />
<div class="form-group">
<!-- input item 1 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 2 fetched result from query1 -->
</div>
</div>
<div class="form-group">
<!-- input item 3 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 4 fetched result from query1 -->
</div>
<div class="form-group">
<!-- input item 5 fetched result from query1 -->
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-12">
<div class="table-header">
Bank Details
</div>
<br />
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1">Bank Name
<span class="important"></span></label>
<div class="col-sm-9">
<!-- input item 1 fetched result from query3 -->
</div>
<div class="form-group">
<!-- input item 2 fetched result from query3 -->
</div>
</div>
<div class="form-group">
<!-- input item 3 fetched result from query3 -->
</div>
</div>
<div class="form-group">
<!-- input item 4 fetched result from query3 -->
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-xs-12">
<div class="table-header">
listing
</div>
<!-- div.table-responsive -->
<!-- div.dataTables_borderWrap -->
<div>
<table id="dynamic-table" name="dynamic-table" class="table table-striped table-bordered table-hover">
<thead>
<!--table fetched values from query2 -->
</table>
</div>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div>
<br/>
<div align="center">
<input name="contact" type="submit" id="contact" value="Update" style="padding:5px" class="sendButton" disabled />
<input name="download" type="submit" id="download" value="Download PDF" style="padding:5px" class="btn btn-danger" />
<input type="hidden" name="staff_id" value="<?php // staff id which you will get from search form ?>">
</div>
</label>
</div>
</form>
</div><!-- /.main-content -->
<div class="footer">
<!-- footer -->
</div>
</div><!-- /.main-container -->
Comment:
When clicking download button, staff id should be populated in hidden
field. Then only you will get staff id. So plz check value while
clicking download button by using print_r();
I want to make a profile page edit for my project. I try something to profile page. But I gave an error.
How can I do profile page ? The error is:
An uncaught Exception was encountered
Type: ArgumentCountError
Message: Too few arguments to function CProfile_edit::update(), 0 passed in C:\xampp\htdocs\erp\system\core\CodeIgniter.php on line 532 and exactly 1 expected
Filename: C:\xampp\htdocs\erp\application\controllers\CProfile_edit.php
Line Number: 14
Backtrace:
File: C:\xampp\htdocs\erp\index.php
Line: 315
Function: require_once
I gave it always. I use session data for take data from customer table. But I can not profile edit. I take this error.
This is my view:
<section class="panel">
<div class="bio-graph-heading">
<?php echo $this->lang->line('profile_edit_top_text'); ?>
</div>
<div class="panel-body bio-graph-info">
<h1> <?php echo $this->lang->line('profile_edit_text_informations'); ?></h1>
<form class="form-horizontal" role="form" method="post" action="<?php echo base_url("CProfile_edit/update/$user->cosId"); ?>">
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_username'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosUserName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_email'); ?></label>
<div class="col-lg-6">
<input type="email" class="form-control" id="email" name="cosEmail" placeholder="<?php echo $this->session->userdata('people_email'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_firstname'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_lastname'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="l-name" name="cosSurname" placeholder="<?php echo $this->session->userdata('people_surname'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_phone'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosPho" placeholder="<?php echo $this->session->userdata('people_phone'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_mobile'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosGsm" placeholder="<?php echo $this->session->userdata('people_mobile'); ?>" />
</div>
</div>
<!-- Basic select -->
<div class="form-group">
<label class="control-label col-lg-3"><?php echo $this->lang->line('cprofile_profile_lang'); ?> <span class="text-danger">*</span></label>
<div class="col-lg-9">
<select name="cosLang" class="form-control">
<option value="<?php echo $this->session->userdata('people_lang'); ?>"><?php echo $this->session->userdata('people_lang'); ?></option>
<option value="en">English</option>
<option value="ar">Arabic</option>
</select>
</div>
</div>
<!-- /basic select -->
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="submit" class="btn btn-success">Save</button>
<button type="button" class="btn btn-default">Cancel</button>
</div>
</div>
</form>
</div>
</section>
There is my controller:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class CProfile_edit extends CI_Controller {
public function index()
{
//redirect(base_url('calendar'));
$this->lang->load('content', $this->session->userdata('people_lang'));
$this->load->view('cprofile_edit');
}
public function update($cusId = 1)
{
if (! empty($cusId))
{
$data = array (
"cosUserName" => $this->input->post("cosUserName"),
"cosEmail" => $this->input->post("cosEmail"),
"cosName" => $this->input->post("cosName"),
"cosSurname" => strtoupper($this->input->post("cosSurname")),
"cosPho" => $this->input->post("cosPho"),
"cosGsm" => $this->input->post("cosGsm"),
"cosLang" => $this->input->post("cosLang"),
"cosEditDate" => date('Y-m-d H:i:s')
);
$update = $this->db->where("cusId", $cusId)->update("customer", $data);
if($update)
{
redirect(base_url("cprofile"));
}
else
{
echo "Hata!";
}
}
}
}
?>
Line Number: 14 error: public function update($cusId) {
Edit Your View and use this code.
<section class="panel">
<div class="bio-graph-heading">
<?php echo $this->lang->line('profile_edit_top_text'); ?>
</div>
<div class="panel-body bio-graph-info">
<h1> <?php echo $this->lang->line('profile_edit_text_informations'); ?></h1>
<form class="form-horizontal" role="form" method="post" action="<?php echo base_url("CProfile_edit/update/".$this->session->userdata('people_id')); ?>">
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_username'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosUserName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_email'); ?></label>
<div class="col-lg-6">
<input type="email" class="form-control" id="email" name="cosEmail" placeholder="<?php echo $this->session->userdata('people_email'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_firstname'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_lastname'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="l-name" name="cosSurname" placeholder="<?php echo $this->session->userdata('people_surname'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_phone'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosPho" placeholder="<?php echo $this->session->userdata('people_phone'); ?>" />
</div>
</div>
<!-- Form -->
<div class="form-group">
<label class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_mobile'); ?></label>
<div class="col-lg-6">
<input type="text" class="form-control" id="f-name" name="cosGsm" placeholder="<?php echo $this->session->userdata('people_mobile'); ?>" />
</div>
</div>
<!-- Basic select -->
<div class="form-group">
<label class="control-label col-lg-3"><?php echo $this->lang->line('cprofile_profile_lang'); ?> <span class="text-danger">*</span></label>
<div class="col-lg-9">
<select name="cosLang" class="form-control">
<option value="<?php echo $this->session->userdata('people_lang'); ?>"><?php echo $this->session->userdata('people_lang'); ?></option>
<option value="en">English</option>
<option value="ar">Arabic</option>
</select>
</div>
</div>
<!-- /basic select -->
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="submit" class="btn btn-success">Save</button>
<button type="button" class="btn btn-default">Cancel</button>
</div>
</div>
</form>
</div>
</section>
<div class="portlet-body">
<form role="form" class="form-horizontal" name="frm_edit_details" id="frm_edit_details" method="POST" action="URL::route('sample/update/')">
<?php if(isset($message) && $message != "") echo "<div class='alert alert-success alert-dismissable'>".$message."</div>"; ?>
<h4> Information </h4>
<?php foreach($lists as $list): ?>
<div class="row">
<div class="form-group">
<label class="col-md-2 control-label"> Customer ID: </label>
<div class="col-md-4">
<input type="text" class="form-control" placeholder="Number" id="CUSTOMER_ID" name="CUSTOMER_ID" value="<?php if(isset($list->CUSTOMER_ID)) echo ($list->CUSTOMER_ID); ?>" />
</div>
<label class="col-md-2 control-label">Invoice Number: </label>
<div class="col-md-4">
<input type="text" class="form-control" placeholder="Number" name="INVOICE_NO" id="INVOICE_NO" value="<?php if(isset($list->INVOICE_NO)) echo ($list->INVOICE_NO); ?>" />
</div>
<label class="col-md-2 control-label">Phone Number: </label>
<div class="col-md-4">
<input type="text" class="form-control" placeholder="Number" name="PHONE_NO" id="PHONE_NO" value="<?php if(isset($list->PHONE_NO)) echo ($list->PHONE_NO); ?>" />
</div>
</div>
</div>
<br>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
Submit
</div>
</div>
<?php endforeach; ?>
</form>
</div>
while displaying the data in PHP form from Database, it is displaying the data in form.
after making some changes and clicking on submit i am able to capture only CUSTOMER_ID data remaining phone number and invoice number i am unable to capture.
I want to capture the complete data after some changes done in the form
you are not submitting your form, because your form has no submit button.Change this line
Submit
with
<input type="submit" name="submit" value="Submit"/>
and add one extra input field in your form to send account id along with your form as
<input type="text" name="accountId" value="{{$list->ACCOUNT_ID}}"/>
So now your form get submitted on this url sample/update/{accountId} as your form action is defined
I have 2 forms, containing employee information that is readOnly=true
My second form contains, input box to replace and update the data inside the first form. My update is a link tag instead of button.
1st Form
<form class="secondtdr" name="updatein">
<h4 class="ua">Referrer Personal Information</h4>
<div class="referrerid">
<p align="left">Referrer ID</p>
<input type="text" name="cont" value="<?php echo $contact_no; ?>" readOnly="true">
</div>
<div class="empnum">
<p align="left">Employee Number</p>
<input type="number" name="cont" value="<?php echo $empid; ?>" readOnly="true">
</div>
2nd Form
<form class="tabletoedit" method="post">
<br>
<div class="empnum">
<p align="left">Employee Number</p><br>
<input type="number" name="cont" value="">
</div>
<div class="fnamep">
<p align="left">Fullname</p>
<input type="text" name="cont" value="">
</div>
<div class="action_btns">
<div class="one_half">
Update
</div>
</div>
</form>
You can achieve it by writing some javascript codes,like this(codes below are not tested).
<script>
function updateData()
{
document.getElementById('form1_employee_num').value = document.getElementById('employee_num').value;
...
//if you wan to update the new data to database,you can use AJAX
}
</script>
form 1
<form class="secondtdr" name="updatein">
<h4 class="ua">Referrer Personal Information</h4>
<div class="referrerid">
<p align="left">Referrer ID</p>
<input type="text" name="cont" value="<?php echo $contact_no; ?>" readOnly="true" id="form1_referrer_id">
</div>
<div class="empnum">
<p align="left">Employee Number</p>
<input type="number" name="cont" value="<?php echo $empid; ?>" readOnly="true" id="form1_employee_num">
</div>
form2
<form class="tabletoedit" method="post">
<br>
<div class="empnum">
<p align="left">Employee Number</p><br>
<input type="number" name="cont" value="" id="employee_num">
</div>
<div class="fnamep">
<p align="left">Fullname</p>
<input type="text" name="cont" value="" id="fullname">
</div>
<div class="action_btns">
<div class="one_half">
Update
</div>
</div>
</form>
I am karthik, in my project i have one problem, i am getting error undefine index: template_id. I have searched more in net but i can't rectify this problem i have attached my code below, please guide me
if($fetquery["template_id"] == 5){
$query = mysql_query("SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."");
$fetquery = mysql_fetch_array($query);
?>
<!-- Template5-->
<input type="hidden" name="template5" value="template5">
<div class="fillContent" id="subscreen5">
<div class="mainTitle">
<h3>Fill Content - Template E</h3>
</div>
<input type="hidden" name="template5id" value="<?php echo $fetquery['temp5_id']; ?>">
<div class="current-title">
<label>Main Title</label> <input type="text" class="fillTitleText" name="etemp5title"placeholder="Lorem Ipsum" value="<?php echo $fetquery['title']; ?>"><!-- Edit -->
</div>
<div class="section2">
<div class="contentSecTitle">
<h3>Banner Image</h3>
</div>
<div class="subSec">
<div class="subSec1">
<div class="contentSec2Left">
<input type="text" id="template5banner" value="<?php echo $fetquery['bannerimage']; ?>" class="upLoadText">
<div class="fileUpload btn btn-primary">
<span class="uploadImage"></span>
<input id="temp5_bannerimg" onchange="addtemplate5banner(this)" name="etemplate5bannerimg" type="file" class="upload" value="Browse">
</div>
</div>
<div class="contentSecRight">
<input type="hidden" name="gettopImage" value="<?php echo $fetquery['bannerimage']; ?>">
<p class="imageView3"><img src="<?php echo $fetquery['bannerimage']; ?>" style="width:82px; height:82px;" id="changetemp5banner"><br><br>Current Image</p>
<!-- <p class="imageView4">filename.jpg</p>
<div class="deLete">
</div>
-->
</div>
</div>
</div>
</div>
<div class="fillSec">
<div class="contentSecTitle">
<h3>Content</h3>
</div>
<div class="current-textarea">
<div class="text-area">
<label>Description</label> <textarea rows="4" name="etemp5desc" ><?php echo $fetquery['description']; ?></textarea>
</div>
</div>
</div>
</div>
<?php
}
if($fetquery["template_id"] == 6){
//echo "SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."";
$query = mysql_query("SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."");
$fetquery = mysql_fetch_array($query);
?>
<!-- Template6-->
<input type="hidden" name="template6" value="template6">
<div class="fillContent" id="subscreen6">
<div class="mainTitle">
<h3>Fill Content - Template F</h3>
</div>
<input type="hidden" name="template6id" value="<?php echo $fetquery['temp6_id']; ?>">
<div class="current-title">
<label>Main Title</label> <input value="<?php echo $fetquery['title']; ?>" type="text" class="fillTitleText" name="etemplate6title" placeholder="Lorem Ipsum"> <!--Edit -->
</div>
<div class="section2">
<div class="contentSecTitle">
<h3>Banner Image</h3>
</div>
<div class="subSec">
<div class="subSec1">
<div class="contentSec2Left">
<input type="text" id="template6banner" value="<?php echo $fetquery['bannerimage']; ?>" class="upLoadText">
<div class="fileUpload btn btn-primary">
<span class="uploadImage"></span>
<input id="temp6_bannerimg" onchange="addtemplate6banner(this)" name="template6bannerimg" type="file" class="upload" value="Browse">
</div>
</div>
<div class="contentSecRight">
<input type="hidden" name="gettopImage" value="<?php echo $fetquery['bannerimage']; ?>">
<p class="imageView3"><img src="<?php echo $fetquery['bannerimage']; ?>" style="width:82px; height:82px;" id="changetemp6banner"><br><br>Current Image</p>
<!-- <p class="imageView4">filename.jpg</p>
<div class="deLete">
</div> -->
</div>
</div>
</div>
</div>
<div class="fillSec">
<div class="contentSecTitle">
<h3>Content</h3>
</div>
<div class="current-textarea">
<div class="text-area">
<label>Desription</label> <textarea rows="4" name="temp6desc"><?php echo $fetquery['description']; ?></textarea>
</div>
</div>
</div>
</div>
<?php } ?>
This code was in ajax page
Try to add a check before using it. And also check if it is defined or not. -
if (!empty($fetquery["template_id"]) && $fetquery["template_id"] == 5) { ...