View unanswered posts | View active topics It is currently Mon May 23, 2022 2:15 am



Reply to topic  [ 1 post ] 
 neep help for inserting values from php to mysql 
Author Message
Junior Member

Joined: Sun Oct 25, 2009 1:04 am
Posts: 14
Post neep help for inserting values from php to mysql
Dear sir I am trying to insert value from Php-html form into mysql. It showing successfully inserted message but it is not inserting Mysql table.

Please help, see following programmming script.

<?php
error_reporting(E_ALL & ~E_NOTICE);
include("connect.php");

if(isset($_POST['submit']))
{

//begin of if($submit).
// Set global variables to easier names
// and pervent sql injection and apostrophe to break the db.
$job_id = mysql_real_escape_string($_POST['job']);
$name = mysql_real_escape_string($_POST['name']);
//print success message.
if((!empty($job_id)) && (!empty($name)))

{

$result = mysql_query("INSERT INTO recruit_master(job_id, name ) values ('$job_id', '$name')", $connect);
echo " $name has been successfully added.";
include "recruit_list.php";
exit();
}

else
{
echo "<b> Please enter Job id & Name first......</b> ". "
";
}


} //end of if($submit)

// If the form has not been submitted, display it!
else
{//begin of else
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><title>
Candidate Profile - Addition
</title></head>
<form action="recruit_master.php" method="POST" >

<table border="0" width="750" align="center" >
<tr>
<td colspan=2 width="750" bgcolor="#999999">
<p align="center"><font color="blue"><span style="font-size:20pt;"><b>Candidate's Information Addition</b></span></font></p>
</td>
</tr>
<tr>
<td width="200" align="left"><b>Job ID & Post</b></td>

<td width="500" align="left">
<?php
$result = mysql_query("SELECT DISTINCT job_id, designation, region_code, dept_code FROM job_master order by job_id", $connect);
echo "<select name=\"job\"><option value=''>- select -</option>";
while($nt=mysql_fetch_array($result))
{
echo "<option value=$nt[job_id]>$nt[job_id]- $nt[designation]-$nt[region_code]-$nt[dept_code]</option>"."
";
}
echo "</select>";// Closing of list box
?> </td>
</tr>
<tr>
<td colspan=2 width="750" bgcolor="#999999">
<p align="center"><font color="blue"><span style="font-size:15pt;"><b>Enter Candidate's profile here</b></span></font></p>
</td>
</tr>


<tr>
<td width="200" align="left"><b>Employee Name *</b></td>

<td width="500" align="left"><input type=text name="name" size="50">
</td>
</tr>
<tr>
<td width="200"> </td>
<td width="500" align="left">
<input type="submit" name="submit" value="S u b m i t"><input type="Reset" value="R e s e t"></td>
</tr>
</table>
</form>
</html>
<?
}//end of else
?>


thanks in advance ,

regards,

Prashant Kadam


Tue Jan 26, 2010 11:20 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.