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) { ...
Related
I am new in php. I have a PHP script which auto generates a tracking number in mysql database cons_no is the name of the table, I wish to enter the cons_no data manually.
Also when I try to edit the cons_no value from the edit page, other things are allowed to be edited - except con_no. Any help will be appreciated.
This is the code that creates the the file with the cons_no value.
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
session_start();
//Include database configuration file
require_once('database-settings.php');
require_once('database.php');
$db = conexion();
require_once('library.php');
require_once('funciones.php');
require 'requirelanguage.php';
include_once "filtro/class/class.php";;
include_once "filtro/class_buscar.php";
require_once("filtro/class/class.inputfilter.php");
$ifilter = new InputFilter();
$_POST = $ifilter->process($_POST);
$sql = "SELECT DISTINCT(off_name)
FROM offices";
$result = dbQuery($sql);
$company=mysql_fetch_array(mysql_query("SELECT * FROM company"));
date_default_timezone_set($_SESSION['ge_timezone']);
$fechai=date('Y-m-d');
$fechaf=date('Y-m-d');
isUser();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $_SESSION['ge_cname']; ?> | <?php echo $ENVIOS; ?></title>
<meta name="description" content="<?php echo $_SESSION['ge_description']; ?>"/>
<meta name="keywords" content="<?php echo $_SESSION['ge_keywords']; ?>" />
<meta name="author" content="Jaomweb">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png"/>
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="../bower_components/animate.css/animate.css" type="text/css" />
<link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../bower_components/simple-line-icons/css/simple-line-icons.css" type="text/css" />
<link rel="stylesheet" href="css/font.css" type="text/css" />
<link rel="stylesheet" href="css/app.css" type="text/css" />
<link href="css/style.css" rel="stylesheet" media="all">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
<!-- Switchery css -->
<link href="assets/plugins/switchery/switchery.min.css" rel="stylesheet" />
<!-- Plugins css -->
<link href="assets/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet">
<link href="assets/plugins/mjolnic-bootstrap-colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
<link href="assets/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
<link href="assets/plugins/clockpicker/bootstrap-clockpicker.min.css" rel="stylesheet">
<link href="assets/plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
</head>
<body>
<?php
include("header.php");
?>
<!-- content -->
<div id="content" class="app-content" role="main">
<div class="app-content-body ">
<div class="wrapper-md">
<div class="row">
<div class="col-sm-12">
<div class="blog-post">
<div class="panel">
<div class="wrapper-lg">
<div>
<tbody>
<div class="row alertaCaja" style="display: none;">
<div class="col-xs-4 col-sm-4 col-md-4" style="float: none; margin: 0 auto;">
<div class="alert alert-dismissible alert danger">
<button type="button" class="close" data-dismiss="alert"><img src="img/close.png" height="15" width="15"></button>
<center>
<?php
require_once('database.php');
$query= mysql_query("SELECT MAX(cid) AS id FROM courier");
if ($row = mysql_fetch_row($query))
{
?>
<a target="_blank" href="print-invoice/invoice-print.php?cid=<?php echo codificar($id = trim($row[0])); ?>">
<img src="img/print-invoice.png" height="76" width="79"></a>
<?php } ?>
<?php
require_once('database.php');
$query= mysql_query("SELECT MAX(cid) AS id FROM courier");
if ($row = mysql_fetch_row($query))
{
?>
<a target="_blank" href="print-invoice/ticket-print.php?cid=<?php echo codificar($id = trim($row[0])); ?>">
<img src="img/print_label.png" height="76" width="79"></a>
<?php } ?>
</center>
</div>
</div>
</div>
<?php if ( isset ( $_GET ['tipo'] ) ) { ?>
<div class="row alertaCaja" style="display: none;" >
<div class="col-xs-6 col-sm-6 col-md-6" style="float: none; margin: 0 auto;">
<div class="alert alert-dismissible alert-<?php echo $_GET ['tipo'] ?>">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong><?php echo $L_['message']; ?></strong><br/><br/> <?php echo $_GET ['mensaje']; ?>
</div>
</div>
</div>
<?php } ?>
<tr>
<h3 class="classic-title"><span><strong><i class="fa fa-truck icon text-default-lter"></i> <?php echo $ADICIONAR; ?></strong></h3>
<!-- START Checkout form -->
<form action="settings/add_courier/agregar.php" method="post" >
<table border="0" align="center" width="100%" >
<div class="row">
<!-- START Presonal information -->
<fieldset class="col-md-6">
<legend><?php echo $datosremite; ?></legend>
<!-- Name -->
<div class="row" >
<div class="col-sm-2 form-group">
<label class="control-label"><i class="fa fa-user icon text-default-lter"></i> <?php echo $StaffRole; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="officename" id="officename" value="<?php echo $_SESSION['user_type'] ;?>" readonly="true" />
</div>
<div class="col-sm-2 form-group">
<label class="control-label"><i class="fa fa-user icon text-default-lter"></i> <?php echo $StaffUser; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="user" id="user" value="<?php echo $_SESSION['user_name'] ;?>" readonly="true" />
</div>
<div class="col-sm-8 form-group">
<label class="control-label" ><?php echo $NOMBREREMITENTE; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="Shippername" id="Shippername" autocomplete="on" list="customers" />
<datalist id="customers">
<?php
$sql=mysql_query("SELECT * FROM tbl_clients");
while($row=mysql_fetch_array($sql)){
echo '<option data-value="'.$row['id'].'">'.utf8_encode($row['name']).'</option>';
}
?>
</datalist>
<input type="hidden" name="Shippername-hidden" id="Shippername-hidden" />
</div>
</div>
<div class="row">
<div id="divRemi">
<div class="col-sm-6 form-group">
<label class="control-label"><?php echo $DIRECCION; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="Shipperaddress" id="Shipperaddress" placeholder="<?php echo $placeremi; ?>" />
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-phone icon text-default-lter"></i> <?php echo $TELEFONO; ?></label>
<input type="tel" class="form-control" name="Shipperphone" id="Shipperphone" placeholder="<?php echo $placetele; ?>" />
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><?php echo $CEDULA; ?></i></label>
<input type="text" class="form-control" name="Shippercc" id="Shippercc" placeholder="<?php echo $placeced; ?>" >
</div>
<div class="col-sm-3 form-group" style="display:none">
<label class="control-label"><?php echo $L_['lockerid']; ?></i></label>
<input type="text" class="form-control" name="Shipperlocker" id="Shipperlocker" placeholder="<?php echo $L_['lockerid']; ?>">
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-angle-double-right icon text-default-lter"></i> <strong><?php echo $PAISORIGEN; ?></strong></label>
<input type="text" class="form-control" name="Pickuptime" id="Shippercountry" placeholder="<?php echo $L_['placecountry']; ?>">
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $L_STATE; ?></strong></label>
<input type="text" class="form-control" name="state" id="Shipperstate" placeholder="<?php echo $L_['placestate']; ?>">
</div>
<div class="col-sm-3 form-group" style="display:none">
<label class="control-label"><strong><?php echo $CODIGO; ?></strong></label>
<input type="text" class="form-control" name="iso" id="Shipperiso" placeholder="<?php echo $L_['placeiso']; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $CIUDAD; ?></strong></label>
<input type="text" class="form-control" id="Shipperciudad" name="ciudad" placeholder="<?php echo $L_['placecity']; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $CODIGOPOSTAL; ?></strong></label>
<input type="text" class="form-control" id="Shipperzipcode" name="zipcode" placeholder="<?php echo $codigopostal; ?>">
</div>
<div class="col-sm-12 form-group">
<p class="error"></p>
<label class="control-label"><?php echo $EMAIL; ?><font color="#FF6100"><?php echo $notaemail; ?></font></i></label>
<input type="email" class="form-control" name="Shipperemail" id="idemail" placeholder="demo#emo.com" autocomplete=" off" onKeyUp="javascript:validateeMail('idemail')" />
<strong><span id="mailOK"></span></strong>
<p class="error"></p>
</div>
</div>
</div>
<!-- Adress and Phone -->
<!-- START Shipment information -->
</br></br>
<legend><?php echo $Informaciondeenvio; ?></legend>
<div class="row">
<!-- Origin Office -->
<div class="col-sm-3 form-group">
<label for="zipcode" class="control-label"><i class="fa fa-angle-double-right icon text-default-lter"></i> <strong><?php echo $OFICINAORIGEN; ?></strong></label>
<select class="form-control" name="Invoiceno">
<?php
while($data = dbFetchAssoc($result)){
?>
<option value="<?php echo $data['off_name']; ?>"><?php echo $data['off_name']; ?></option>
<?php
}//while
?>
</select>
</div>
<div class="col-sm-3 form-group">
<label for="ccv" class="control-label"><strong><?php echo $CantidadPaquetes; ?></strong></i></label>
<input type="number" class="form-control" name="Qnty" placeholder="<?php echo $placecant; ?>" />
</div>
<!-- Text area -->
<div class="col-sm-6 form-group">
<label for="inputTextarea" class="control-label"><i class="fa fa-comments icon text-default-lter"></i> <?php echo $DetallesdelEnvio; ?></label>
<textarea class="form-control" name="Comments" placeholder="<?php echo $placedetails; ?>" ></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-5 form-group">
<label class="control-label"><i class="fa fa-database icon text-default-lter"></i> <strong><?php echo $Pagos; ?></strong></label>
<select class="form-control" name="bookingmode">
<option selected="selected" value="Effective"><?php echo $Effective; ?></option>
<option value="Debit_card"><?php echo $Debitcard; ?></option>
<option value="Credit_card"><?php echo $Creditcard; ?></option>
<option value="Transfer"><?php echo $Transfer; ?></option>
<option value="Online"><?php echo $Payonline; ?></option>
<option value="Paypal"><?php echo $L_['type_paypal']; ?></option>
</select>
</div>
<div class="col-sm-4 form-group">
<label class="control-label"><?php echo $TipodeProducto; ?></label>
<select type="text" class="form-control" name="Shiptype" >
<?php
$sql="SELECT name FROM type_shipments GROUP BY name";
$query=$db->query($sql);
if($query->num_rows>0){
while($row=$query->fetch_array()){
echo '<option data-value="'.$row['name'].'">'.utf8_encode($row['name']).'</option>';
}
}
?>
</select>
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-plane icon text-default-lter"></i> <?php echo $MododelServicio; ?></label>
<select class="form-control" name="Mode">
<?php
$sql="SELECT name FROM mode_bookings GROUP BY name";
$query=$db->query($sql);
if($query->num_rows>0){
while($row=$query->fetch_array()){
echo '<option data-value="'.$row['name'].'">'.utf8_encode($row['name']).'</option>';
}
}
?>
</select>
</div>
</div>
<!-- Payment Mode -->
<div class="row">
<div class="col-sm-3 form-group" >
<label class="text-danger"><strong><?php echo $_SESSION['ge_curr']; ?> <?php echo $ValorDeclarado; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum2" name="Totaldeclarate" value="0" />
</div>
<div class="col-sm-3 form-group" >
<label class="text-danger"><strong><?php echo $Declarado; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum5" name="Totaldeclarado" value="4" />
</div>
<div class="col-sm-3 form-group">
<label for="ccv" class="text-danger"><strong><?php echo $_SESSION['ge_curr']; ?> <?php echo $ValorRecogida; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum3" name="Totalfreight" value="0" />
</div>
<div class="col-sm-3 form-group">
<label class="text-danger"><strong><?php echo $_SESSION['ge_curr']; ?> <?php echo $PrimerKilo; ?> <?php echo $_SESSION['ge_measure']; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum1" name="variable" value="3.25" />
</div>
<div class="col-sm-3 form-group">
<label class="text-danger"><strong><?php echo $_SESSION['ge_curr']; ?> <?php echo $_SESSION['ge_measure']; ?> <?php echo $KiloAdicional; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum6" name="kiloadicional" value="3.25" />
</div>
<div class="col-sm-3 form-group">
<label class="text-danger"><strong><?php echo $PesoKg; ?> (<?php echo $_SESSION['ge_measure']; ?>)<strong></label>
<input type="text" class="form-control" required onblur="if(this.value == ''){this.value='0'}" onKeyUp="suma();" id="sum4" name="Weight" value="0" />
</div>
<div class="col-sm-3 form-group">
<label class="text-danger"><strong><?php echo $SubtotalEnvio; ?><strong></i></label>
<input type="text" class="form-control" name="shipping_subtotal" id="resultado" value="0" />
</div>
<div class="col-sm-3 form-group">
<label class="text-danger"><strong><?php echo $_SESSION['ge_curr']; ?> <?php echo $PesoFisico; ?><strong></label>
<input type="text" class="form-control" id="pesoreal" name="pesoreal" onblur="if(this.value == ''){this.value='0'}" >
</div>
</div>
<legend><?php echo $pesovolumetrico; ?>:</legend>
<!-- Peso Volumetrico -->
<div class="row">
<div class="col-sm-3 form-group">
<label class="text-primary"><strong><?php echo $Altura; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="volumetrico();" id="volume1" name="altura" placeholder="<?php echo $Altura; ?>" />
</div>
<div class="col-sm-3 form-group">
<label class="text-primary"><strong><?php echo $Ancho; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="svolumetrico();" id="volume2" name="ancho" placeholder="<?php echo $Ancho; ?>" />
</div>
<div class="col-sm-3 form-group">
<label class="text-primary"><strong><?php echo $Longitud; ?><strong></label>
<input type="text" class="form-control" onblur="if(this.value == ''){this.value='0'}" onKeyUp="volumetrico();" id="volume3" name="longitud" placeholder="<?php echo $Longitud; ?>" />
</div>
<div class="col-sm-3 form-group">
<label class="text-primary"><strong><?php echo $TotalPesoVolumetrico; ?><strong></i></label>
<input type="text" class="form-control" name="totalpeso" id="totalpeso" placeholder="0,00" />
</div>
</div>
</fieldset>
<!-- START Receiver info -->
<fieldset class="col-md-6">
<legend><?php echo $DatosDestinatario; ?></legend>
<!-- Name -->
<div class="form-group">
<label class="control-label"><?php echo $NOMBREDESTINATARIO; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="Receivername" id="Receivername" autocomplete="on" list="customers" >
</div>
<!-- Adress and Phone -->
<div class="row">
<div class="col-sm-3 form-group">
<label class="control-label"><?php echo $DIRECCION; ?><span class="required-field">*</span></label>
<input type="text" class="form-control" name="Receiveraddress" id="Receiveraddress" placeholder="<?php echo $placedirdesti; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-phone icon text-default-lter"></i> <?php echo $TELEFONO; ?></label>
<input type="tel" class="form-control" name="Receiverphone" id="Receiverphone" placeholder="<?php echo $placeteldesti; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-phone icon text-default-lter"></i> <?php echo $TELEFONO2; ?></label>
<input type="tel" class="form-control" name="telefono1" id="Receivertelefono1" placeholder="<?php echo $placeteldesti; ?>">
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><?php echo $CEDULA; ?></i></label>
<input type="text" class="form-control" name="Receivercc_r" id="Receivercc_r" placeholder="<?php echo $L_['placecedr']; ?>">
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><i class="fa fa-angle-double-right icon text-default-lter"></i> <strong><?php echo $PAISDESTINO; ?></strong></label>
<input type="text" class="form-control" name="paisdestino" id="Receivercountry1" placeholder="<?php echo $L_['placecountry1']; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $L_STATE; ?></strong></label>
<input type="text" class="form-control" name="state1" id="Receiverstate1" placeholder="<?php echo $L_['placestate']; ?>" >
</div>
<div class="col-sm-3 form-group" style="display:none">
<label class="control-label"><strong><?php echo $CODIGO; ?></strong></label>
<input type="text" class="form-control" name="iso1" id="Receiveriso1" placeholder="<?php echo $L_['placeiso']; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $CIUDAD; ?></strong></label>
<input type="text" class="form-control" name="city1" id="Receivercity1" placeholder="<?php echo $L_['placecity']; ?>" >
</div>
<div class="col-sm-3 form-group">
<label class="control-label"><strong><?php echo $CODIGOPOSTAL; ?></strong></label>
<input type="text" class="form-control" name="zipcode1" id="Receiverzipcode1" placeholder="<?php echo $codigopostal; ?>">
</div>
<div class="col-sm-12 form-group">
<p class="error"></p>
<label class="control-label"><?php echo $EMAIL; ?><font color="#FF6100"><?php echo $notaemail; ?></font></i></label>
<input type="email" class="form-control" name="Receiveremail" id="id_mail" placeholder="demo#emo.com" onKeyUp="javascript:validateMail('id_mail')" >
<strong><span id="emailOK"></span></strong>
<p class="error"></p>
</div>
</div>
</br></br>
<!-- Name -->
<div class="form-group">
<label for="name-card" class="text-success"><strong><?php echo $NUMEROENVIO; ?></strong></label>
<?php
$qryEmpresa = mysql_query("SELECT * FROM company");
while($row = mysql_fetch_array($qryEmpresa)) {
$pre = $row["prefijo"];
$cons = $row["cons_no"];
}
mysql_free_result($qryEmpresa);
$pa=mysql_query("SELECT MAX(cons_no)as maximo FROM c_tracking");
if($row=mysql_fetch_array($pa)){
if($row['maximo']==NULL){
$cons_no=''.$cons.'';
}else{
$cons_no=$row['maximo']+1;
}
}
?>
<input type="text" class="form-control" value="<?php echo $_SESSION['ge_prefix']; ?>-<?php echo "".$cons_no; ?>">
</div>
</br>
<!-- Status and Pickup Date -->
<div class="form-group">
<label for="dtp_input1" class="control-label"><i class="fa fa-calendar icon text-default-lter"></i> <?php echo $FECHARECOLECCIONENVIO; ?></i></label>
<div>
<div class="input-group">
<input type="text" class="form-control" name="Packupdate" placeholder="mm/dd/yyyy" id="datepicker-autoclose" >
<span class="input-group-addon bg-custom b-0"><i class="glyphicon glyphicon-calendar"></i></span>
</div><!-- input-group -->
</div>
</div>
<div class="row">
<div class="col-sm-4 form-group">
<label for="month" class="control-label"><i class="fa fa-sort-amount-asc icon text-default-lter"></i> <?php echo $estado; ?></label>
<select class="form-control" name="status" id="status">
<?php
$sql="SELECT servicemode FROM service_mode GROUP BY servicemode";
$query=$db->query($sql);
if($query->num_rows>0){
while($row=$query->fetch_array()){
echo '<option data-value="'.$row['servicemode'].'">'.utf8_encode($row['servicemode']).'</option>';
}
}
?>
</select>
</div>
<div class="col-sm-8 form-group">
<label for="dtp_input1" class="control-label"><i class="fa fa-calendar icon text-default-lter"></i> <?php echo $fechaestimadadeliver; ?></i></label>
<div>
<div class="input-group">
<input type="text" class="form-control" name="Schedule" placeholder="mm/dd/yyyy" id="datepicker">
<span class="input-group-addon bg-custom b-0"><i class="glyphicon glyphicon-calendar"></i></span>
</div><!-- input-group -->
</div>
</fieldset>
<div class="col-md-6 text-left">
</br></br>
<button type="submit" id="submit" class="btn btn-large btn-success"><?php echo $GUARDARENVIO; ?></button>
</div>
</div>
</div>
</div>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- / content -->
<?php include("footer.php"); ?>
<?php include("footer_add_courier.php"); ?>
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>
EDIT.PHP
<?php
//error_reporting(0);
include("DB.php");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$sql="SELECT * FROM hrmsinfo WHERE emp_id='$id'";
$sqll=mysqli_query($link,$sql);
while($profile=mysqli_fetch_array($link,$sqll))
{
$username=$profile['emp_name'];
$usermail=$profile['emp_email'];
$userdob=$profile['emp_dob'];
$usermobile=$profile['emp_phno'];
$useraddress=$profile['emp_address'];
$userproof=$profile['emp_proof'];
?>
<div class="display">
<form action="UPDATE.php" method="post" name="insertform">
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Name:</div>
<div class="col-xs-4"><input type="text" class="form-control" name="ename" placeholder="Enter Name" value="<?php echo $username; ?>" id="inputid"></div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">EMAIL:</div>
<div class="col-xs-4"><input type="text" class="form-control" name="eemail" placeholder="Enter Email" value="<?php echo $usermail; ?>" id="inputid"></div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Date Of Birth:</div>
<div class="col-xs-5">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="date" class="form-control pull-right" name="edateofbirth" value="<?php echo $userdob; ?>" id="inputid">
</div>
</div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Mobile Number:</div>
<div class="col-xs-5">
<input type="text" class="form-control" placeholder="Enter Mobile" name="emobile" value="<?php echo $usermobile; ?>" id="inputid">
</div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Address:</div>
<div class="col-xs-5">
<textarea class="form-control" rows="3" placeholder="Enter Address" name="epresentaddress" value="<?php echo $useraddress; ?>" id="inputid"></textarea>
</div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Proof:</div>
<div class="col-xs-5">
<input type="text" class="form-control" placeholder="Enter Proof" name="edrivinglicense" value="<?php echo $userproof; ?>" id="inputid">
</div>
</div>
</div>
</p>
<p>
<div class="form-group">
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-5">
<input type="submit" name="eupdate" value="Update" id="inputid1" />
</div>
</div>
</div>
</p>
</form>
</div>
<?php } } ?>
UPDATE.PHP
<?php
include('DB.php');
if(isset($_GET['id']))
{
$id=$_GET['id'];
if(isset($_POST['update']))
{
$name=mysqli_real_escape_string($link,$_POST["ename"]);
$email=mysqli_real_escape_string($link,$_POST["eemail"]);
$enpassword=mysqli_real_escape_string($link,$_POST["epassword"]);
$dateofbirth=mysqli_real_escape_string($link,$_POST["edateofbirth"]);
$mobile=mysqli_real_escape_string($link,$_POST["emobile"]);
$presentaddress=mysqli_real_escape_string($link,$_POST["eaddress"]);
$drivinglicense=mysqli_real_escape_string($link,$_POST["edrivinglicense"]);
$updated=mysqli_query("UPDATE `hrmsinfo` SET `emp_name`=[$name],`emp_email`=[$email],`emp_password`=[$enpassword],`emp_dob`=[$dateofbirth],`emp_phno`=[$mobile],`emp_address`=[$presentaddress],`emp_proof`=[$drivinglicense] WHERE emp_id='$id'");
if($result = mysqli_query($link, $updated))
{
$msg="Successfully Updated!!";
header('Location:VIEW.php');
}
else
{
$msg="Unsucessfull!!";
}
}
} //update ends here
?>
MY code keeps popping me error like this:-
mysqli_fetch_array() expects parameter 1 to be mysqli_result
what is wrong with this where am i wrong when i remove id it works can i get the id as parameter call for edit and update help me with this
this is because of the line:-
while($profile=mysqli_fetch_array($link,$sqll)){
Here you need to pass the Query-result-set object only.
So change it to:-
$sqll=mysqli_query($link,$sql);
while($profile=mysqli_fetch_array($sqll)){
UPDATE.php
<?php
include('DB.php');
if(isset($_GET['id'])){
$id=$_GET['id'];
if(isset($_POST['update'])){
$name=mysqli_real_escape_string($link,$_POST["ename"]);
$email=mysqli_real_escape_string($link,$_POST["eemail"]);
$enpassword=mysqli_real_escape_string($link,$_POST["epassword"]);
$dateofbirth=mysqli_real_escape_string($link,$_POST["edateofbirth"]);
$mobile=mysqli_real_escape_string($link,$_POST["emobile"]);
$presentaddress=mysqli_real_escape_string($link,$_POST["epresentaddress"] );
$drivinglicense=mysqli_real_escape_string($link,$_POST["edrivinglicense"]);
if(mysqli_query("UPDATE hrmsinfo SET emp_name=$name,emp_email=$email,emp_password=$enpassword,emp_dob=$dateofbirth,emp_phno=$mobile,emp_address=$presentaddress,emp_proof=$drivinglicense WHERE emp_id='$id'")){
$msg="Successfully Updated!!";
header('Location:VIEW.php');
}
else{
$msg="Unsucessfull!!";
}
}
} //update ends here
?>
When ever i try to execute this update code with following edit code it displays blank page help me with it
The below is edit code which executes perfectly but update doesnt work at all help me where am i stuck
<?php
//error_reporting(0);
include("DB.php");
if(isset($_GET['id'])){
$id=$_GET['id'];
$sql="SELECT * FROM hrmsinfo WHERE emp_id='$id'";
$sqll=mysqli_query($link,$sql);
while($profile=mysqli_fetch_array($sqll)){
$username=$profile['emp_name'];
$usermail=$profile['emp_email'];
$userdob=$profile['emp_dob'];
$usermobile=$profile['emp_phno'];
$useraddress=$profile['emp_address'];
$userproof=$profile['emp_proof'];
?>
<div>
<form action="UPDATE.php" method="post" name="insertform">
<div class="form-group">
<div class="row">
<div class="col-xs-3">Name:</div>
<div class="col-xs-4"><input type="text" class="form-control" name="ename" placeholder="Enter Name" value="<?php echo $username; ?>" id="inputid"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Email:</div>
<div class="col-xs-4"><input type="text" class="form-control" name="eemail" placeholder="Enter Email" value="<?php echo $usermail; ?>" id="inputid"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Password:</div>
<div class="col-xs-3"><input type="password" class="form-control" name="epassword" id="inputid" placeholder="Enter Password" id='input_id'></div>
<div class="col-xs-3"><input type="password" class="form-control" name="epassword" id="inputid" placeholder="Re-Enter Password" id='input_id'></div>
<div class="col-xs-3">
<div class="checkbox"><input type="checkbox"> Auto Generate</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Date Of Birth:</div>
<div class="col-xs-5">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="date" class="form-control pull-right" name="edateofbirth" value="<?php echo $userdob; ?>" id="inputid">
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Mobile Number:</div>
<div class="col-xs-5">
<input type="text" class="form-control" placeholder="Enter Mobile" name="emobile" value="<?php echo $usermobile; ?>" id="inputid">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Address:</div>
<div class="col-xs-5">
<textarea class="form-control" rows="3" placeholder="Enter Address" name="epresentaddress" value="<?php echo $useraddress; ?>" id="inputid"></textarea>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3">Proof:</div>
<div class="col-xs-5">
<input type="text" class="form-control" placeholder="Enter Proof" name="edrivinglicense" value="<?php echo $userproof; ?>" id="inputid">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-5">
<input type="submit" name="update" value="Update" id="inputid1" />
</div>
</div>
</div>
</form>
</div>
<?php } } ?>
Please help me with proper guidance where am i stuck here or i am making mistake
as per your code you put one condition i.e.
if(isset($_GET['id']))
{
.....
}
but in html form you are not pass any id field add id field and try your condition will verify and update will work.
just add one field like below.. remaining is same.
<form action="UPDATE.php?id=<?php echo $id; ?>" method="post" name="insertform">
<input type="hidden" name="id" value="<?php echo $id; ?>" >
...............
.................
</form>
Note: In HTML page id of field should be unique.
I wan to use securimage captcha for my drupal site,
I have one registration form and and I am submitting that form on same page.
Securimage configuration document says that (here) use session_start() on first line of form processor.
I am having both form and form processor on same page so where should I write session_start()?
This is my code
<form id="user_form" action="" method="post">
<div class="form">
<?php if (isset($errors) && count($errors)>0) : ?>
<ul class="error-list">
<?php foreach ($errors as $e) : ?>
<li><?php echo $e; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="form-section">
<div class="col">
<div class="row">
<label class="two-rows">Select your<br />account type <span>*</span></label>
<select name="uf_user_type" style="width:173px;" class="required">
<option value="">None Selected</option>
<option value="<?php print JOB_SEEKER_ROLE; ?>">Job Seeker</option>
<option value="<?php print MASTER_EMPLOYER_ROLE; ?>">Employer</option>
</select>
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>First Name <span>*</span></label>
<input type="text" class="field required" name="uf_first_name" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>Last Name <span>*</span></label>
<input type="text" class="field required" name="uf_last_name" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label>Email <span>*</span></label>
<input type="text" class="field required email-field" name="uf_mail" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<div class="cl"> </div>
</div>
<div class="row">
<label class="two-rows">Image <span>*</span></label>
<img id="captcha" src="/sites/all/themes/jobnow/site/securimage/securimage_show.php" alt="CAPTCHA Image" height="45" width="160" style="border:1px solid #b9b9b9"/>
<a href="#" onclick="document.getElementById('captcha').src = '/sites/all/themes/jobnow/site/securimage/securimage_show.php?' + Math.random(); return false">
<img src="/sites/all/themes/jobnow/site/securimage/images/refresh.png" height="30" width="30" alt="Reload Image" onclick="this.blur()" align="bottom" border="0">
</a>
</div>
</div>
<div class="col right-col">
<div class="row">
<label class="two-rows">How did you <br />hear about us? <span>*</span></label>
<select name="uf_hear_about_us" style="width:173px;" class="required">
<option value="">None Selected</option>
<option>Colleague/Friend</option>
<option>Search Engine</option>
<option>LinkedIn</option>
<option>Twitter</option>
<option>Facebook</option>
<option>Advertisement</option>
<option>In The News</option>
<option>Trade Show/Organization</option>
<option>Other</option>
</select>
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<p class="hint"><?php echo bfstring('hint_register_password'); ?></p>
<label>Password <span>*</span></label>
<input type="password" class="field required" id="pass1" name="uf_password" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label class="two-rows">Confirm <br />Password <span>*</span></label>
<input type="password" class="field required" id="pass2" name="uf_password2" />
<div class="cl"> </div>
<em class="status"></em>
</div>
<div class="row">
<label class="labelBlack">
<input type="checkbox" class="check required" name="uf_terms" value="1" <?php if(isset($_POST['uf_terms']) && $_POST['uf_terms'] == 1) print 'checked'; ?> />
</label>
<p>I accept the Terms of Service.</p>
<div class="cl"> </div>
</div>
<div class="row">
<div class="cl"> </div>
</div>
<div class="row">
<label class="two-rows">What code is<br />in the image?<span>*</span></label>
<input type="text" class="field required" name="captcha_code" size="10" maxlength="6" />
<div class="cl"> </div>
<em class="status"></em>
</div>
</div>
<div class="cl"> </div>
</div>
<div>
</div>
<div class="form-actions">
<span class="required-info"><strong>*</strong> required</span>
<input type="submit" class="form-submit" value="Create Account" />
Cancel
<div class="cl"> </div>
</div>
</div>
</form>
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$securimage = new Securimage();
$isSecurImageValid=$securimage->check($_POST['captcha_code']) != false;
if ($validator->validateRules($_POST) && $isSecurImageValid)
{
$new_user = new stdClass();
$new_user->roles = array();
$username_base =strtolower(preg_replace('~(.*)\#.*~', '$1', site_rgpc($_POST['uf_mail'])));
$usernames = array();
}
else
{
$errors = $validator->getErrors();
if(!$isSecurImageValid)
$errors[]="The Security Code wasn't entered correctly.";
}
When I integrated this code on my site its saying your captcha is wrong for each and every attempt.
I am not getting what is the issue ?
Same code is working without session_start() on my another similar site.
Please help me