Notice: Undefined index: id in \editcountry.php on line 17 incorrect INTEGER value:
Hello,
I have an update recordset behaviour but somehow on submitting the update, I am getting this error: Notice: Undefined index: id in \editcountry.php on line 17
incorrect INTEGER value:
Website is on localhost.
This is the code:
<?php require_once('Connections/database.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php
$getcity = new WA_MySQLi_RS("getcity",$database,1);
$getcity->setQuery("SELECT database_city.*, database_country.* FROM database_city INNER JOIN database_country ON database_city.city_country = database_country.id WHERE database_city.id = ?");
$getcity->bindParam("i", "".(isset($_GET['id'])?$_GET['id']:"") ."", "-1"); //WAQB_Param1
$getcity->execute();?>
<?php
$getcountry = new WA_MySQLi_RS("getcountry",$database,0);
$getcountry->setQuery("SELECT * FROM database_country ORDER BY country ASC");
$getcountry->execute();
?>
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$UpdateQuery = new WA_MySQLi_Query($database);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "database_city";
$UpdateQuery->bindColumn("city_country", "i", "".($getcity->getColumnVal("id")) ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("city", "s", "".((isset($_POST["city"]))?$_POST["city"]:"") ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("date", "t", "".((isset($_POST["date"]))?$_POST["date"]:"") ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("user", "i", "".((isset($_POST["user"]))?$_POST["user"]:"") ."", "WA_DEFAULT");
$UpdateQuery->addFilter("id", "=", "i", "".($_GET['id']) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<!-- SITE TITTLE -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pavlino Consulting Database Portal</title>
<!-- PLUGINS CSS STYLE -->
<link href="plugins/jquery-ui.css" rel="stylesheet" type="text/css">
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="plugins/rs-plugin/css/settings.css" media="screen">
<link rel="stylesheet" type="text/css" href="plugins/selectbox/select_option1.css">
<link rel="stylesheet" type="text/css" href="plugins/datepicker/datepicker.css">
<link rel="stylesheet" type="text/css" href="plugins/isotope/jquery.fancybox.css">
<link rel="stylesheet" type="text/css" href="plugins/isotope/isotope.css">
<!-- GOOGLE FONT -->
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<!-- CUSTOM CSS -->
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="css/colors/default.css" id="option_color">
<!-- FAVICON -->
<link rel="shortcut icon" type="image/png" href="image/favicon.png"/>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="main-wrapper">
<!-- HEADER -->
<header>
<?php include('nav.php'); ?>
</header>
<!-- PAGE TITLE
<section class="pageTitle" style="background-image:url();">
-->
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="titleTable">
<div class="titleTableInner">
<div class="pageTitleInfo">
<h1>Admin Panel</h1>
<div class="under-border"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- PAGE CONTENT -->
<section class="mainContentSection blogSidebar">
<div class="container">
<div class="row">
<div class="col-sm-12 col-xs-12">
<div class="thumbnail blogSinglePost">
<div class="caption">
<h1>Edit City</h1>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="POST" role="form" class="form">
<div class="form-group">
<select name="city_country">
<?php
$wa_startindex = 0;
while(!$getcountry->atEnd()) {
$wa_startindex = $getcountry->Index;
?>
<option value="<?php echo($getcountry->getColumnVal("id")); ?>" <?php
if ($getcountry->getColumnVal("id")==$getcity->getColumnVal("city_country") )
echo 'selected="selected"' ;
?>>
<?php echo($getcountry->getColumnVal("country")); ?></option>
<?php
$getcountry->moveNext();
}
$getcountry->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" id="city" name="city" value="<?php echo($getcity->getColumnVal("city")); ?>" required>
</div>
<div class="form-group">
<input type="hidden" class="form-control" id="date" name="date" value="<?php $date = date('Y-m-d'); echo $date; ?>" />
</div>
<div class="form-group">
<input type="hidden" class="form-control" id="user" name="user" value="<?php echo $_SESSION['userid']; ?>" />
</div>
<button type="submit" name="submit" class="btn buttonCustomPrimary">Update City</button>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- FOOTER -->
<?php include('footer.php'); ?>
</div>
<!-- JAVASCRIPTS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="plugins/jquery-ui/jquery-ui.js"></script>
<script src="plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="plugins/rs-plugin/js/jquery.themepunch.tools.min.js"></script>
<script src="plugins/rs-plugin/js/jquery.themepunch.revolution.min.js"></script>
<script src="plugins/selectbox/jquery.selectbox-0.1.3.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js"></script>
<script src="plugins/counter-up/jquery.counterup.min.js"></script>
<script src="plugins/isotope/isotope.min.js"></script>
<script src="plugins/isotope/jquery.fancybox.pack.js"></script>
<script src="plugins/isotope/isotope-triger.js"></script>
<script src="plugins/countdown/jquery.syotimer.js"></script>
<script src="js/custom.js"></script>
</body>
</html>