codeigniter profile page edit - 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>

Related

Stop PHP from auto generating values

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"); ?>

If statement within PHP template in wordpress

With a WordPress PHP template - I what doing an if statement to check if user is logged in, if he is then I want to show an email form and if he's not I want to ask users to login.
<?php if ( is_user_logged_in() ) {
<div role="tabpanel" class="tab-panel active" id="nomessage">
<div class="row">
<div class="col-lg-12">
<h4>You have to be logged in to send a message</h4>
</div>
</div>
</div>
} else {
<div class="tab-content">
<?php if($classieraToAuthor == 1){?>
<div role="tabpanel" class="tab-pane active" id="message">
<!--ShownMessage-->
<?php if(isset($_POST['submit']) && $_POST['submit'] == 'send_message'){?>
<div class="row">
<div class="col-lg-12">
<?php if($hasError == true){ ?>
<div class="alert alert-warning">
<?php echo $errorMessage; ?>
</div>
<?php } ?>
<?php if($emailSent == true){ ?>
<div class="alert alert-success">
<?php echo $classieraContactThankyou; ?>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<!--ShownMessage-->
<form method="post" class="form-horizontal" data-toggle="validator" name="contactForm" action="<?php the_permalink(); ?>">
<div class="form-group">
<label class="col-sm-3 control-label" for="name"><?php esc_html_e('Name', 'classiera') ?> :</label>
<div class="col-sm-9">
<input id="name" data-minlength="5" type="text" class="form-control form-control-xs" name="contactName" placeholder="<?php esc_html_e('Type your name', 'classiera') ?>" required>
</div>
</div><!--name-->
<div class="form-group">
<label class="col-sm-3 control-label" for="email"><?php esc_html_e('Email', 'classiera') ?> :</label>
<div class="col-sm-9">
<input id="email" type="email" class="form-control form-control-xs" name="email" placeholder="<?php esc_html_e('Type your email', 'classiera') ?>" required>
</div>
</div><!--Email-->
<div class="form-group">
<label class="col-sm-3 control-label" for="subject"><?php esc_html_e('Subject', 'classiera') ?> :</label>
<div class="col-sm-9">
<input id="subject" type="text" class="form-control form-control-xs" name="subject" placeholder="<?php esc_html_e('Type your subject', 'classiera') ?>" required>
</div>
</div><!--Subject-->
<div class="form-group">
<label class="col-sm-3 control-label" for="msg"><?php esc_html_e('Message', 'classiera') ?> :</label>
<div class="col-sm-9">
<textarea id="msg" name="comments" class="form-control" placeholder="<?php esc_html_e('Type Message', 'classiera') ?>" required></textarea>
</div>
</div><!--Message-->
<?php
$classieraFirstNumber = rand(1,9);
$classieraLastNumber = rand(1,9);
$classieraNumberAnswer = $classieraFirstNumber + $classieraLastNumber;
?>
<div class="form-group">
<div class="col-sm-9">
<p>
<?php esc_html_e("Please input the result of ", "classiera"); ?>
<?php echo $classieraFirstNumber; ?> + <?php echo $classieraLastNumber;?> =
</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="humanTest"><?php esc_html_e('Answer', 'classiera') ?> :</label>
<div class="col-sm-9">
<input id="humanTest" type="text" class="form-control form-control-xs" name="humanTest" placeholder="<?php esc_html_e('Your answer', 'classiera') ?>" required>
<input type="hidden" name="humanAnswer" id="humanAnswer" value="<?php echo $classieraNumberAnswer; ?>" />
<input type="hidden" name="classiera_post_title" id="classiera_post_title" value="<?php the_title(); ?>" />
<input type="hidden" name="classiera_post_url" id="classiera_post_url" value="<?php the_permalink(); ?>" />
</div>
</div><!--answer-->
<input type="hidden" name="submit" value="send_message" />
<button class="btn btn-primary btn-block btn-sm sharp btn-style-one" name="send_message" value="send_message" type="submit"><?php esc_html_e( 'Send Message', 'classiera' ); ?></button>
</form>
</div>
};
?>
First, I have added an if statement to check whether the user is logged in or not, if he is the first element is shown where is tells the user it has to be logged in to send a message. Then, if he is logged in a message form is shown instead.
Cannot get it to work, would appreciate all help a lot! Thanks in advance!
You couldn't mix PHP and HTML like this. You're missing to close PHP tag ?> before to write HTML.
EDIT As pointed by #mmm, your test is the inverse of what you want. You have to negate your test using the character !.
Try this :
<?php if ( ! is_user_logged_in() ) : ?>
<div role="tabpanel" class="tab-panel active" id="nomessage">
<div class="row">
<div class="col-lg-12">
<h4>You have to be logged in to send a message</h4>
</div>
</div>
</div>
<?php else: ?>
<!-- other HTML -->
<?php endif; ?>
Or :
<?php if ( is_user_logged_in() ) { ?>
<div role="tabpanel" class="tab-panel active" id="nomessage">
<div class="row">
<div class="col-lg-12">
<h4>You have to be logged in to send a message</h4>
</div>
</div>
</div>
<?php } else { ?>
<!-- other HTML -->
<?php } ?>

The temporary folder is missing in codeigniter

I am using Codeigniter 3
and uploading a file using upload library in CodeIgniter whenever I upload the file it's giving me The temporary folder is missing.
I am confusing why it's giving me this error because I uploaded my project on a server its working fine on that server but when I upload same files on another server it's giving me this error I don't why.
Here is my code
HTML
<div class="storecreatewrapper">
<div class="toptext">
<div class="container">
<div class="row">
<div class="col-md-12">
<p>Let's build your store at <span><?php echo PROJECT;?>!</span></p>
</div>
</div>
</div>
</div>
<div class="formwrapper">
<form action="<?php echo site_url('shop/addshop')?>" enctype="multipart/form-data" method="post" accept-charset="utf-8" id="adsp_09">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="mianstoreform">
<div class="row">
<div class="col-md-12">
<div class="formtopimg">
<img src="<?php echo base_url('assets/images/logos/storepic.png') ?>" >
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="mainbasictxt">
<div class="bsichr"></div>
<div class="basictxt">
<p>Basic Shop Information</p>
</div>
</div>
<div class="form-group">
<?php c_error();?>
</div>
</div>
</div>
<div class="stformfields">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Shop Name <span class="red">*</span></label>
<?php
$shopname = array(
'class' => 'form-control',
'id' => 'shopname',
'placeholder' => 'Shop Name',
'name'=>'shopname'
);
echo form_input($shopname);
?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Shop URL <span class="red">*</span></label>
<?php
$shopurl = array(
'class' => 'form-control',
'id' => 'fohopurl',
'name'=>'shpurl',
'placeholder' => 'Shop URL: www.'.PROJECT.'.com/shops/URL'
);
echo form_input($shopurl);
?>
</div>
</div>
</div>
</div>
<div class="custmhr"></div>
<div class="row">
<div class="col-md-12">
<div class="mainbasictxt">
<div class="bsichr"></div>
<div class="basictxt">
<p>Account Verification Detail</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="frmrads">
<div class="pull-left cusradhead">
Account Type:
</div>
<div class="pull-left">
<div class="radio">
<label>
<input class="act_9" type="radio" name="at" id="individual" value="individual" checked>
Individual Professional.
</label>
</div>
<div class="radio">
<label>
<input class="act_9" type="radio" name="at" id="business" value="business">
Business (Selling On Behalf of a Business Entity).
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="documtslt">
<div class="row">
<div class="col-sm-10 lftcolset">
<div class="form-group">
<select name="dcname" id="dcm_67">
<option selected="select">
Document (Please Select)
</option>
<option value="national id">National ID</option>
<option value="passport">Passport</option>
</select>
</div>
</div>
<div class="col-sm-2 rytcolset">
<input id="file-upload" type="file" name="ushplg" style="display:none"/>
<button type="button" id="upfile1" class="btn cutsltbtn" for="file-upload">Image</button>
</div>
</div>
</div>
</div>
</div>
<div class="docfrmffl">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<?php
$shopurl = array(
'class' => 'form-control',
'id' => 'document_id',
'placeholder' => 'Document ID',
'name'=>'document_id'
);
echo form_input($shopurl);
?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="notetxt">
Note: English (a-z,A-Z), digits(0-9), - , spaces.
</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<?php
$shopurl = array(
'class' => 'form-control expiry_date',
'id' => 'datepicker',
'placeholder' => 'Expiry Date',
'name'=>'expiry_date'
);
echo form_input($shopurl);
?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="notetxt">
Note: JPEG, PNG or PDF only and 2MB file size.
</p>
</div>
</div>
</div>
<div class="custmhr"></div>
<div class="row">
<div class="col-md-12">
<div class="mainbasictxt">
<div class="bsichr"></div>
<div class="basictxt">
<p>Order Pickup Location</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="frmrads">
<div class="pull-left">
<?php if(is_logedin()): //if logedin ?>
<?php if(
$this->session->userdata('city_id') && $this->session->userdata('area_id') && $this->session->userdata('direction')
):
?>
<div class="radio">
<label>
<input class="loc_09" type="radio" name="location" id="shipping" value="shipping" checked>
Same as my shipping address
</label>
</div>
<?php else: // if loggedin and city area and direction not found. ?>
<div class="radio">
<label>
<input class="loc_09" type="radio" name="location" id="new_address" value="new_address" checked>
Register a new address
</label>
</div>
<?php endif; //checking if shipping addres set or not..?>
<?php else: ?>
<div class="radio">
<label>
<input class="loc_09" type="radio" name="location" id="new_address" value="new_address" checked>
Register a new address
</label>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="locations">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>City <span class="red">*</span></label>
<select name="city" class="city_9 sada" disabled>
<option value="none" selected="select">City</option>
<?php if($cities->num_rows() > 0):
foreach ($cities->result() as $city):
?>
<option value="<?php echo $city->c_id ?>">
<?php echo $city->city_name ?></option>
<?php endforeach;?>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Area <span class="red">*</span></label>
<!-- <select name="area" id="area" class="sada" disabled>
<option selected="select">Select Area</option>
</select> -->
<span class="pslare">
</span>
<input type="text" class="form-control caresshx" id="areasped" placeholder="Area" value="">
<input type="hidden" name="area" value="" id="ardix">
<!-- <select name="area" id="area" class="sada" <?php if($shop_info[0]['location'] == 1){ echo 'disabled';}?>>
<option selected="select">Select Area</option>
</select> -->
<ul class="ullist list-unstyled">
</ul>
</div>
</div>
</div>
</div>
<div class="docfrmffl">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control sada" name="street" id="street" placeholder="Street" disabled>
</div>
<div class="form-group">
<input type="text" name="build_num" class="form-control sada" placeholder="Building Name" disabled id="build_num">
</div>
<div class="form-group">
<?php
$rft = array(
'class'=>'form-control',
'name'=>'rft',
'placeholder'=>'House Number'
);
echo form_input($rft);
?>
</div>
<div class="form-group">
<label>Direction <span class="red">*</span></label>
<textarea class="form-control" name="direction" rows="3" id="flladdrs" placeholder="Direction"></textarea>
</div>
<div class="form-group">
Click here to choose from map
</div>
<div class="form-group tsslid" id="opmap" style="display: none">
<div class="form-group">
<input id="address" type="text" placeholder="Enter an address" class="form-control">
<!-- Cancel -->
</div>
<div class="form-group">
Close map
</div>
<div id="map"></div>
</div>
</div>
</div>
</div>
<div class="custmhr"></div>
<div class="row">
<div class="col-md-12">
<div class="mainbasictxt">
<div class="bsichr"></div>
<div class="basictxt">
<p>Contact Information</p>
</div>
</div>
</div>
</div>
<div class="docfrmffl">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>First Name <span class="red">*</span></label>
<?php if(is_logedin()): ?>
<input type="text" class="form-control" name="fname" placeholder="First Name" value="<?php echo get_session_element('fname');?>" readonly id="fname">
<?php else: ?>
<input type="text" class="form-control" name="fname" placeholder="First Name" id="fname">
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Last Name <span class="red">*</span></label>
<?php if(is_logedin()): ?>
<input type="text" name="lname" class="form-control" placeholder="Last Name" value="<?php echo get_session_element('lname');?>" readonly id="lname">
<?php else: ?>
<input type="text" name="lname" class="form-control" placeholder="Last Name" id="lname">
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Email <span class="red">*</span></label>
<?php if(is_logedin()): ?>
<input type="text" name="email" class="form-control" placeholder="Email" value="<?php echo get_session_element('email');?>" readonly id="email">
<?php else: ?>
<input type="text" name="email" class="form-control" placeholder="Email" id="email">
<?php endif; ?>
</div>
</div>
</div>
<?php if(!is_logedin()): ?>
<div class="row" class="lng" id="lng">
<div class="col-md-12">
<div class="form-group">
<label>Password <span class="red">*</span></label>
<input type="password" name="pass" id="pass" placeholder="Enter You Password" class="form-control" >
</div>
<div class="form-group">
<label>Confirm Password <span class="red">*</span></label>
<input type="password" id="cnpass" placeholder="Confirm Password" class="form-control" name="cnpass">
</div>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Mobile Phone <span class="red">*</span></label>
<?php if(is_logedin()): ?>
<input type="text" name="mob" class="form-control" placeholder="Mobile Phone" value="<?php echo get_session_element('mobile');?>" id="mob">
<?php else: ?>
<input type="text" name="mob" class="form-control" placeholder="Mobile Phone" id="mob">
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>LandLine <span class="red">*</span></label>
<?php if(is_logedin()): ?>
<input type="text" name="landline" class="form-control" placeholder="LandLine" value="<?php echo get_session_element('phone');?>" id="landline">
<?php else: ?>
<input type="text" name="landline" class="form-control" placeholder="LandLine" id="landline">
<?php endif; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="agreementtxt">
<input type="checkbox" name="agreement" id="arg_098">
I have read and accepted terms and conditions of the agreement.
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="createbtndv">
<input type="submit" class="btn custmsubmit edupfl" value="Create Store" disabled="disabled" id="btnsb">
</div>
<div class="form-group snofd">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
echo form_close();
?>
</div>
</div>
PHP
$image_path = realpath(APPPATH . '../assets/images/usershop');
$config['upload_path'] = $image_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = random_string('alnum', 16);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('ushplg'))
{
$error = $this->upload->display_errors('<p>','</p>');
c_flash('alert-danger',$error,'shop/open');
}
else
{
$filename = $this->upload->data();
$data['doc_image'] = $filename['file_name'];
}
$add_n_shop = $this->mod_shop->add_new_shop($data);
if ($add_n_shop)
{
c_flash('alert-success','Your shop has been created but review by admin.','user/about');
}
else
{
c_flash('alert-danger','Your shop has not been created.','shop/open');
}
This can also happen when you run out of disk space or there don't have available inodes. In my case I faced this error because PHP session files were using up all the inodes.
The following answer can help you with further investigation:
https://askubuntu.com/a/1107896

I am getting error at this part in EDIT.php and Update.php mysqli_fetch_array() expects parameter 1 to be mysqli_result

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)){

Blank Page or Empty Page when seeing update.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["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,em‌​p_phno=$mobile,emp_a‌​ddress=$presentaddress,emp_proof=$drivin‌​glicense 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.

Categories