PHP(Hypertext Preprocessor)is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document.
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname",$con);
?>
<?php
// login
if(isset($_REQUEST['im']))
{
echo $_SESSION['str'];
}
if(isset($_POST['btn_submit']))
{
$login_rs = mysql_query("select * from tablename where user='" . $_POST['txt_name'] ."' and password='" . $_POST['txt_password']."'");
$arr=mysql_fetch_array($login_rs);
if($arr!="")
{
//echo "inside";
$_SESSION['uid']=$arr['1'];
$nme=$_POST['txt_name'];
header("location:welcome.php?nme=$nme");
}
else{
$str= "Login Error....";
$_SESSION['str']=$str;
//echo $_SESSION['str'];
header("location:index.php?im=1");
}
}?>
{
$designation=$_POST['designation'];
$jobpr=$_POST['jobprofile'];
//echo $nme;
$dd="insert into tablename value('','$designation','$jobpr')";
//echo $dd;
mysql_query($dd) or die(mysql_error());
$string= " Saved Successfully ";
echo "$string"; }
<?php
$result = mysql_query("SELECT * FROM tablename") or die(mysql_error()) ;
while($row = mysql_fetch_array($result))
{
?>
<?php echo $row['feildname or 0']?>
<?php
}
?>
{ $id=$_POST['radiobutton'];
$id="$id";
mysql_query("DELETE FROM tablename WHERE name='$id' ");
$str= " deleted successfully "; }
$result=mysql_query("select * from tablename");
while($row=mysql_fetch_array($result))
{
?>
<option value=" <?php echo $row['1']; ?>"> <?php echo $row['1']; ?></option>
<?php
// End while loop.
}
?>
</select>