<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("DanishDB");
$a = $_POST["search_btn"];
$b = $_POST[txt_roleID];
if(isset($a))
{
$q="select * from role
where role_id='$b' ";
$r=mysql_query($q);
while($loop_variable=mysql_fetch_array($r))
{
$roleId=$loop_variable["role_id"];
$roleName=$loop_variable["roleName"];
}
}
echo "<form action='#' method='post'>
role ID: <input type='text' name='txt_roleID' value='$roleId' /><br>
role Name: <input type='text' name='roleName' value='$roleName'/><br>
<input type='submit' value='Search' name='search_btn' /> ";
echo "</form>";
?>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("DanishDB");
$a = $_POST['Insert'];
$b = $_POST["roleName"];
if(isset($a))
{
if($b!="")
{
$query="insert into role(role_id ,roleName) values ('','$b' ) ";
$result=mysql_query($query);
if($result)
{
$red_colour_message.="Data inserted in Table ";
}
else
{
$red_colour_message.="Data not inserted in Table ";
}
}
else
{
$red_colour_message.= "Sorry for Null value";
}
}
echo "<form action='#' method='post'>
role ID: <input type='text' name='roleID' value='$roleId' /><br>
role Name: <input type='text' name='roleName' value='$roleName'/><br> ";
echo "<input type='submit' value='Insert' name='Insert' />
<br>
<font color='red'>$red_colour_message</font></form>";
?>
mysql_connect("127.0.0.1","root","");
mysql_select_db("DanishDB");
$a = $_POST["search_btn"];
$b = $_POST[txt_roleID];
if(isset($a))
{
$q="select * from role
where role_id='$b' ";
$r=mysql_query($q);
while($loop_variable=mysql_fetch_array($r))
{
$roleId=$loop_variable["role_id"];
$roleName=$loop_variable["roleName"];
}
}
echo "<form action='#' method='post'>
role ID: <input type='text' name='txt_roleID' value='$roleId' /><br>
role Name: <input type='text' name='roleName' value='$roleName'/><br>
<input type='submit' value='Search' name='search_btn' /> ";
echo "</form>";
?>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("DanishDB");
$a = $_POST['Insert'];
$b = $_POST["roleName"];
if(isset($a))
{
if($b!="")
{
$query="insert into role(role_id ,roleName) values ('','$b' ) ";
$result=mysql_query($query);
if($result)
{
$red_colour_message.="Data inserted in Table ";
}
else
{
$red_colour_message.="Data not inserted in Table ";
}
}
else
{
$red_colour_message.= "Sorry for Null value";
}
}
echo "<form action='#' method='post'>
role ID: <input type='text' name='roleID' value='$roleId' /><br>
role Name: <input type='text' name='roleName' value='$roleName'/><br> ";
echo "<input type='submit' value='Insert' name='Insert' />
<br>
<font color='red'>$red_colour_message</font></form>";
?>
No comments:
Post a Comment