Abdul Waheed Abdul Waheed - 5 months ago 47
MySQL Question

Undefined value is storing in database

enter image description here

I am getting a blank row stored in the table by this code

<table id="jobSkills" ">
<tr><td class="col-xs-4"> Skill </td>
<p><span>addSkills">+ Add Skills</span><p>

jquery Add+++ More script:

var skillcount=0;
$('#jobSkills tr:last').after('<tr><td><input name="skill['+skillcount+'][title]" type="text" "></td></tr>');

Controller code to strore in db:

foreach($_POST["skill"] as $k=>$key)
$conn->query("INSERT INTO r_job_skill (id_job,title) values ('".$jobId."','".$key["title"]."')");


There Might be two possible cases.

Either you are getting the null values to you php File. Perform the insert Operation when there are all the values are available at PHP File

if($_POST["skill"] !='')
 // insert Query goes Here

Or you are send an Extra value to the PHP File , with out other values Check you HTML Code , You Might have an Extra Name with the Parameter, that is bringing the values to your PHP File.