{"id":14904,"date":"2022-10-09T15:00:05","date_gmt":"2022-10-09T09:30:05","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/"},"modified":"2022-10-09T15:00:05","modified_gmt":"2022-10-09T09:30:05","slug":"solved-how-can-i-solve-this-undefined-index","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/","title":{"rendered":"[Solved] How can i solve this Undefined index:?"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-51471538\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"51471538\" data-parentid=\"51471406\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>You need to use <code>isset()<\/code> to avoid these errors. something like given below.<\/p>\n<pre><code>&lt;?php\ninclude_once 'config.php';\nif (isset($_POST['employee_id'])) {\n\n$employee_id=$_POST['employee_id'];\n$name=$_POST['name'];\n$date_of_birth=$_POST['date_of_birth'];\n$gender=$_POST['gender'];\n$marital_status=$_POST['marital_status'];\n$nationality=$_POST['nationality'];\n$present_address=$_POST['present_address'];\n$city=$_POST['city'];\n$country=$_POST['country'];\n$phone=$_POST['phone'];\n$email=$_POST['email'];\n$nip=$_POST['nip'];\n$status=$_POST['status'];\n$designation=$_POST['designation'];\n$joining_date=$_POST['joining_date'];\n$leaving_date=$_POST['leaving_date'];\n$picture = basename($_FILES['picture']['name']);\n\nif (!empty($_FILES['picture'])) {   \n    $path = \"admin\/gambar\/\";\n    $path = $path . basename($_FILES['picture']['name']);\n    if (move_uploaded_file($_FILES['picture']['tmp_name'], $path)) {\n        echo \"The file \" . basename($_FILES['picture']['name']) .\n        \" has been uploaded\";\n    } else {\n        echo \"There was an error uploading the file, please try again\";\n    }\n}\n\n$query = \"UPDATE employee_list set name=\"$name\", date_of_birth=\"$date_of_birth\", gender=\"$gender\", marital_status=\"$marital_status\", nationality='$nationality', present_address=\"$present_address\", city='$city', country='$country', phone=\"$phone\", email=\"$email\", nip=$nip, status=\"$status\", designation='$designation', joining_date=\"$joining_date\", leaving_date=\"$leaving_date\", picture=\"$picture\" where employee_id=$employee_id\";\n}\n?&gt;\n<\/code><\/pre>\n<blockquote>\n<p>Note:Use prepared query to avoid sql injection attack.<\/p>\n<\/blockquote><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">8<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How can i solve this Undefined index:? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] You need to use isset() to avoid these errors. something like given below. &lt;?php include_once &#8216;config.php&#8217;; if (isset($_POST[&#8217;employee_id&#8217;])) { $employee_id=$_POST[&#8217;employee_id&#8217;]; $name=$_POST[&#8216;name&#8217;]; $date_of_birth=$_POST[&#8216;date_of_birth&#8217;]; $gender=$_POST[&#8216;gender&#8217;]; $marital_status=$_POST[&#8216;marital_status&#8217;]; $nationality=$_POST[&#8216;nationality&#8217;]; $present_address=$_POST[&#8216;present_address&#8217;]; $city=$_POST[&#8216;city&#8217;]; $country=$_POST[&#8216;country&#8217;]; $phone=$_POST[&#8216;phone&#8217;]; $email=$_POST[&#8217;email&#8217;]; $nip=$_POST[&#8216;nip&#8217;]; $status=$_POST[&#8216;status&#8217;]; $designation=$_POST[&#8216;designation&#8217;]; $joining_date=$_POST[&#8216;joining_date&#8217;]; $leaving_date=$_POST[&#8216;leaving_date&#8217;]; $picture = basename($_FILES[&#8216;picture&#8217;][&#8216;name&#8217;]); if (!empty($_FILES[&#8216;picture&#8217;])) { $path = &#8220;admin\/gambar\/&#8221;; $path = $path . basename($_FILES[&#8216;picture&#8217;][&#8216;name&#8217;]); if (move_uploaded_file($_FILES[&#8216;picture&#8217;][&#8216;tmp_name&#8217;], $path)) { echo &#8230; <a title=\"[Solved] How can i solve this Undefined index:?\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\" aria-label=\"More on [Solved] How can i solve this Undefined index:?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[1437,339],"class_list":["post-14904","post","type-post","status-publish","format-standard","hentry","category-solved","tag-bootstrap-4","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How can i solve this Undefined index:? - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How can i solve this Undefined index:? - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] You need to use isset() to avoid these errors. something like given below. &lt;?php include_once &#039;config.php&#039;; if (isset($_POST[&#039;employee_id&#039;])) { $employee_id=$_POST[&#039;employee_id&#039;]; $name=$_POST[&#039;name&#039;]; $date_of_birth=$_POST[&#039;date_of_birth&#039;]; $gender=$_POST[&#039;gender&#039;]; $marital_status=$_POST[&#039;marital_status&#039;]; $nationality=$_POST[&#039;nationality&#039;]; $present_address=$_POST[&#039;present_address&#039;]; $city=$_POST[&#039;city&#039;]; $country=$_POST[&#039;country&#039;]; $phone=$_POST[&#039;phone&#039;]; $email=$_POST[&#039;email&#039;]; $nip=$_POST[&#039;nip&#039;]; $status=$_POST[&#039;status&#039;]; $designation=$_POST[&#039;designation&#039;]; $joining_date=$_POST[&#039;joining_date&#039;]; $leaving_date=$_POST[&#039;leaving_date&#039;]; $picture = basename($_FILES[&#039;picture&#039;][&#039;name&#039;]); if (!empty($_FILES[&#039;picture&#039;])) { $path = &quot;admin\/gambar\/&quot;; $path = $path . basename($_FILES[&#039;picture&#039;][&#039;name&#039;]); if (move_uploaded_file($_FILES[&#039;picture&#039;][&#039;tmp_name&#039;], $path)) { echo ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-09T09:30:05+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How can i solve this Undefined index:?\",\"datePublished\":\"2022-10-09T09:30:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\"},\"wordCount\":39,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"bootstrap-4\",\"php\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\",\"name\":\"[Solved] How can i solve this Undefined index:? - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-10-09T09:30:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How can i solve this Undefined index:?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How can i solve this Undefined index:? - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How can i solve this Undefined index:? - JassWeb","og_description":"[ad_1] You need to use isset() to avoid these errors. something like given below. &lt;?php include_once 'config.php'; if (isset($_POST['employee_id'])) { $employee_id=$_POST['employee_id']; $name=$_POST['name']; $date_of_birth=$_POST['date_of_birth']; $gender=$_POST['gender']; $marital_status=$_POST['marital_status']; $nationality=$_POST['nationality']; $present_address=$_POST['present_address']; $city=$_POST['city']; $country=$_POST['country']; $phone=$_POST['phone']; $email=$_POST['email']; $nip=$_POST['nip']; $status=$_POST['status']; $designation=$_POST['designation']; $joining_date=$_POST['joining_date']; $leaving_date=$_POST['leaving_date']; $picture = basename($_FILES['picture']['name']); if (!empty($_FILES['picture'])) { $path = \"admin\/gambar\/\"; $path = $path . basename($_FILES['picture']['name']); if (move_uploaded_file($_FILES['picture']['tmp_name'], $path)) { echo ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/","og_site_name":"JassWeb","article_published_time":"2022-10-09T09:30:05+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How can i solve this Undefined index:?","datePublished":"2022-10-09T09:30:05+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/"},"wordCount":39,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["bootstrap-4","php"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/","url":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/","name":"[Solved] How can i solve this Undefined index:? - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-10-09T09:30:05+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-can-i-solve-this-undefined-index\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How can i solve this Undefined index:?"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/14904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=14904"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/14904\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=14904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=14904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=14904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}