Below is my job post code, it cannot post into database... WHAT IS THE PROBLEM OF IT??
[PHP]<?php
session_start() ;
ob_start();
//connect to server and select database
$conn=mysql_con nect("localhost ", "root", "") or die (mysql_error()) ;
mysql_select_db ("ums e-job portal", $conn) or die(mysql_error ());
//If the form was submitted, process it.
if (isset($_POST['submit'])){
$problem=FALSE;
//check for empty value in each mandatory field.
if (empty($_POST['jobTitle'])||empty($_POST['jobType'])||empty($_POST['jobCategory'])||empty($_POST['jobPosition'])||empty($_POST['jobLocation'])||empty($_POST['mRequirement'])||empty($_POST['jobDescription '])){
$problem=TRUE;
echo '<p>Please make sure you enter all the required fields!</p>';
}
//if no problem then insert values into the abstract table in the database.
if (!$problem){
$query = "INSERT INTO job values ( '', '$_SESSION[company_ID]', '$_SESSION[companyName]', '$_SESSION[contactName]' , '$_SESSION[emailAdd]', '$_SESSION[contactNum]', '$_SESSION[contactAdd]', '$_POST[jobTitle]', '$_POST[jobType]', '$_POST[jobCategory]', '$_POST[jobPosition]', '$_POST[jobLocation]', '$_POST[mRequirement]', '$_POST[jobDescription]', now() )";
if(mysql_query( $query)){
echo 'The job has been posted.<br>';
exit ();
}else{
echo 'The job could not be submitted. Because:'.mysql _error();
}
}#end of insert values if.
}#end of submit if...
// construct SQL statement
$sql =mysql_query("S ELECT * FROM company WHERE company_ID='{$_ SESSION['company_ID']}'");
$rows=@mysql_fe tch_array($sql)
?>[/PHP]
[HTML]<form name="act" method="post" action="jobPost .php">
<table width="600" border="0">
<tr>
<td colspan="3"><fo nt color="#000000" ><strong>COMPAN Y CONTACT INFORMATION</strong></font></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Company Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="companyNa me" type="text" maxlength="30" value="<? echo $rows['companyName'];?>"></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Contact Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="contactNa me" type="text" maxlength="30" value="<? echo $rows['contactName'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Email Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="emailAdd" type="text" maxlength="50" value="<? echo $rows['emailAdd'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Number</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="contactNu m" type="text" maxlength="11" value="<? echo $rows['contactNum'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><textarea name="contactAd d" cols="30" rows="3"><? echo $rows['contactAdd'];?></textarea> </textarea>
</td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<td colspan="3"><fo nt color="#000000" ><strong>JOB INFORMATION</strong></font></td>
<tr>
<td width="217"><fo nt color="#000000" >Job Title</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="jobTitle" type="text" maxlength="30"> </td>
</tr>
<tr>
<td><font color="#000000" >Job Type</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobType">
<option selected></option>
<option>Permane nt/Full Time</option>
<option>Tempora ry/Part Time</option>
<option>Interns hips</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Category</font> </td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobCatego ry">
<option selected></option>
<option>Account ing</option>
<option>Adverti sing</option>
<option>Agricul ture</option>
<option>Banking </option>
<option>Biotech nology</option>
<option>Chemica l Eng</option>
<option>Chemist ry</option>
<option>Clerica l/Admin</option>
<option>Custome r Service</option>
<option>Educati on</option>
<option>Electro nics Eng</option>
<option>Food Tech</option>
<option>Gener al Workers</option>
<option>Graphic s</option>
<option>Healthc are</option>
<option>Hotel/Food</option>
<option>Human Resources</option>
<option>IT/Computer</option>
<option>Journal ist/Editor</option>
<option>Manufac turing</option>
<option>Marketi ng</option>
<option>Mechani cal Eng</option>
<option>Media/Entertain</option>
<option>Persona l Care</option>
<option>Publish ing</option>
<option>Purchas ing</option>
<option>Quantit y Survey</option>
<option>Sales </option>
<option>Scien ce/Tech</option>
<option>Secreta rial</option>
<option>Socia l Services</option>
<option>Trainin g</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Position Level</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobPositi on">
<option selected></option>
<option>Senio r Manager</option>
<option>Manager </option>
<option>Senio r Executive</option>
<option>Junio r Executive</option>
<option>Non-Executive</option>
<option>Fresh/Entry Level</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Location</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobLocati on">
<option selected></option>
<option>Perli s</option>
<option>Penan g</option>
<option>Kedah </option>
<option>Perak </option>
<option>Kelanta n</option>
<option>Terengg anu</option>
<option>Pahan g</option>
<option>Selango r</option>
<option>Kuala Lumpur</option>
<option>Neger i Sembilan</option>
<option>Melak a</option>
<option>Johor </option>
<option>Labua n</option>
<option>Sabah </option>
<option>Sarawak </option>
</select></td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >Minimal Requirement</font></td>
</tr>
<tr>
<td height="75" colspan="3"> <textarea name="mRequirem ent" cols="66" rows="4"></textarea></td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<tr>
<td colspan="3">Job Description</td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >
<textarea name="jobDescri ption" cols="66" rows="4"></textarea>
</font></td>
</tr>
<tr>
<td colspan="2"><di v align="center">
<input name="Post Job" type="submit" id="Post Job" value="Post Job">
</div></td>
<td><div align="center">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
<p> </p>
</form>[/HTML]
[PHP]<?php
session_start() ;
ob_start();
//connect to server and select database
$conn=mysql_con nect("localhost ", "root", "") or die (mysql_error()) ;
mysql_select_db ("ums e-job portal", $conn) or die(mysql_error ());
//If the form was submitted, process it.
if (isset($_POST['submit'])){
$problem=FALSE;
//check for empty value in each mandatory field.
if (empty($_POST['jobTitle'])||empty($_POST['jobType'])||empty($_POST['jobCategory'])||empty($_POST['jobPosition'])||empty($_POST['jobLocation'])||empty($_POST['mRequirement'])||empty($_POST['jobDescription '])){
$problem=TRUE;
echo '<p>Please make sure you enter all the required fields!</p>';
}
//if no problem then insert values into the abstract table in the database.
if (!$problem){
$query = "INSERT INTO job values ( '', '$_SESSION[company_ID]', '$_SESSION[companyName]', '$_SESSION[contactName]' , '$_SESSION[emailAdd]', '$_SESSION[contactNum]', '$_SESSION[contactAdd]', '$_POST[jobTitle]', '$_POST[jobType]', '$_POST[jobCategory]', '$_POST[jobPosition]', '$_POST[jobLocation]', '$_POST[mRequirement]', '$_POST[jobDescription]', now() )";
if(mysql_query( $query)){
echo 'The job has been posted.<br>';
exit ();
}else{
echo 'The job could not be submitted. Because:'.mysql _error();
}
}#end of insert values if.
}#end of submit if...
// construct SQL statement
$sql =mysql_query("S ELECT * FROM company WHERE company_ID='{$_ SESSION['company_ID']}'");
$rows=@mysql_fe tch_array($sql)
?>[/PHP]
[HTML]<form name="act" method="post" action="jobPost .php">
<table width="600" border="0">
<tr>
<td colspan="3"><fo nt color="#000000" ><strong>COMPAN Y CONTACT INFORMATION</strong></font></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Company Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="companyNa me" type="text" maxlength="30" value="<? echo $rows['companyName'];?>"></td>
</tr>
<tr>
<td width="217"><fo nt color="#000000" >Contact Name</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="contactNa me" type="text" maxlength="30" value="<? echo $rows['contactName'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Email Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="emailAdd" type="text" maxlength="50" value="<? echo $rows['emailAdd'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Number</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><input name="contactNu m" type="text" maxlength="11" value="<? echo $rows['contactNum'];?>"></td>
</tr>
<tr>
<td><font color="#000000" >Contact Address</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><textarea name="contactAd d" cols="30" rows="3"><? echo $rows['contactAdd'];?></textarea> </textarea>
</td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<td colspan="3"><fo nt color="#000000" ><strong>JOB INFORMATION</strong></font></td>
<tr>
<td width="217"><fo nt color="#000000" >Job Title</font><font color="#000000" > </font></td>
<td width="30"><div align="center"> <strong>:</strong></div></td>
<td width="339"><in put name="jobTitle" type="text" maxlength="30"> </td>
</tr>
<tr>
<td><font color="#000000" >Job Type</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobType">
<option selected></option>
<option>Permane nt/Full Time</option>
<option>Tempora ry/Part Time</option>
<option>Interns hips</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Category</font> </td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobCatego ry">
<option selected></option>
<option>Account ing</option>
<option>Adverti sing</option>
<option>Agricul ture</option>
<option>Banking </option>
<option>Biotech nology</option>
<option>Chemica l Eng</option>
<option>Chemist ry</option>
<option>Clerica l/Admin</option>
<option>Custome r Service</option>
<option>Educati on</option>
<option>Electro nics Eng</option>
<option>Food Tech</option>
<option>Gener al Workers</option>
<option>Graphic s</option>
<option>Healthc are</option>
<option>Hotel/Food</option>
<option>Human Resources</option>
<option>IT/Computer</option>
<option>Journal ist/Editor</option>
<option>Manufac turing</option>
<option>Marketi ng</option>
<option>Mechani cal Eng</option>
<option>Media/Entertain</option>
<option>Persona l Care</option>
<option>Publish ing</option>
<option>Purchas ing</option>
<option>Quantit y Survey</option>
<option>Sales </option>
<option>Scien ce/Tech</option>
<option>Secreta rial</option>
<option>Socia l Services</option>
<option>Trainin g</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Position Level</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobPositi on">
<option selected></option>
<option>Senio r Manager</option>
<option>Manager </option>
<option>Senio r Executive</option>
<option>Junio r Executive</option>
<option>Non-Executive</option>
<option>Fresh/Entry Level</option>
<option>Other s</option>
</select></td>
</tr>
<tr>
<td><font color="#000000" >Job Location</font></td>
<td><div align="center"> <strong>:</strong></div></td>
<td><select name="jobLocati on">
<option selected></option>
<option>Perli s</option>
<option>Penan g</option>
<option>Kedah </option>
<option>Perak </option>
<option>Kelanta n</option>
<option>Terengg anu</option>
<option>Pahan g</option>
<option>Selango r</option>
<option>Kuala Lumpur</option>
<option>Neger i Sembilan</option>
<option>Melak a</option>
<option>Johor </option>
<option>Labua n</option>
<option>Sabah </option>
<option>Sarawak </option>
</select></td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >Minimal Requirement</font></td>
</tr>
<tr>
<td height="75" colspan="3"> <textarea name="mRequirem ent" cols="66" rows="4"></textarea></td>
</tr>
<tr>
<td colspan="3"><di v align="center"> </div></td>
</tr>
<tr>
<td colspan="3">Job Description</td>
</tr>
<tr>
<td colspan="3"><fo nt color="#000000" >
<textarea name="jobDescri ption" cols="66" rows="4"></textarea>
</font></td>
</tr>
<tr>
<td colspan="2"><di v align="center">
<input name="Post Job" type="submit" id="Post Job" value="Post Job">
</div></td>
<td><div align="center">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
<p> </p>
</form>[/HTML]
Comment