NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php
$btn='Submit';
include 'connection.php';
if($con)
{
if(isset($_POST['submitbtn']))
{
$fullname=$_POST['fullname'];
$email=$_POST['email'];
$password=$_POST['password'];
$gender=$_POST['gen'];
$address=$_POST['address'];
$chk=$_POST['chk'];
$course=implode(',',$chk);//convert array into string

$file=$_FILES['myfile'];
//$nm='';
$nm=$file['name'];

if($_POST['submitbtn']=='Submit')
{

if(empty($file['name']))
{
$nm='download.jpg';

}
else
{
$nm=$file['name'];
move_uploaded_file($file['tmp_name'],"upload/".$nm);

}


# insert data
echo $qry="insert into tbl_user(fullname,email,password,gen,address,chk,myfile)
values('$fullname','$email','$password','$gender','$address','$course','$nm')";
$result=mysqli_query($con,$qry);
if($result)
echo '<script>alert("Row inserted successfully!!")</script>';
else
echo '<script>alert("Failed to insert data !!")</script>';
}




else if($_POST['submitbtn']=='Update Data')
{

if(empty($file['name']))
{
$nm=$_POST['hiddenimg'];
}
else
{
$nm=$file['name'];
move_uploaded_file($file['tmp_name'],"upload/".$nm);

}

$hid=$_POST['hiddenid'];
$qry="update tbl_user set fullname='$fullname',email='$email',password='$password',gen='$gender',address='$address',chl='$course',='$nm' where id='$hid'";
$result=mysqli_query($con,$qry);
if($result)
echo '<script>alert("Row updated successfully!!")</script>';
else
echo '<script>alert("Failed to update data !!")</script>';
}


}
# delete records
if(isset($_REQUEST['delid']))
{
$delid=$_REQUEST['delid'];
$qry="delete from tbl_user where id='$delid'";
$res=mysqli_query($con,$qry);
if($res)
echo '<script>alert("Row deleted successfully!!")</script>';
else
echo '<script>alert("Failed to delete data !!")</script>';
}
# edit records
$fname='';
$email='';
$pass='';
$gen='';
$add='';
$course='';
$editid='';
$editimg='';
if(isset($_REQUEST['editid']))
{
$btn='Update Data';
$editid=$_REQUEST['editid'];
$qry="select * from tbl_user where id=$editid";
$res=mysqli_query($con,$qry);
if($row=mysqli_fetch_assoc($res))
{
$fname=$row['fullname'];
$email=$row['email'];
$pass=$row['password'];
$gen=$row['gen'];
$add=$row['address'];
$course=$row['chk'];
$editimg=$row['myfile'];
}
}
}
else
die('Failed.......');

?>
<!doctype html>
<html>
<head>
</head>
<body>
<center>
<form method="post" action="form.php" enctype="multipart/form-data">
<input type="hidden" value="<?=$editid?>" name="hiddenid">
<input type="hidden" value="<?=$editimg?>" name="hiddenimg">
<h1>Register Here</h1>
<table border="1px" width="60%" bgcolor="beige" cellpadding="20px" cellspacing="0px">
<tr>
<tD>Enter Name</td>
<td><input type="text" name="fullname" required value="<?php echo $fname; ?>"></td>
</tr>
<tr>
<tD>Enter Email</td>
<td><input type="email" name="email" required value="<?=$email?>" ></td>
</tr>
<tr>
<tD>Enter Password</td>
<td><input type="password" name="password" required value="<?=$pass?>"></td>
</tr>
<tr>
<td>Select Gender</td>
<Td><input type="radio" name="gen" value="Male" required <?php if($gen=='Male') echo 'checked'; ?>>Male
<input type="radio" name="gen" value="Female" <?php if($gen=='Female') echo 'checked'; ?>>Female</td>
</tr>
<tr>
<td>Enter Address</td>
<td><textarea rows="10" cols="22" name="address" required><?=$add?></textarea></td>
</tr>


<tr>
<td>Select Course</td>
<td><input type="checkbox" value="PHP" name="chk[]" <?php if(strpos($course,"PHP")!==false) echo 'checked'; ?>>PHP<input type="checkbox" value="JAVA" name="chk[]" <?php if(strpos($course,"JAVA")!==false) echo 'checked'; ?>>JAVA</td>
</tr>
<tr>
<td>Upload Image
</tD>
<td><input type="file" name="myfile"><?php if(!empty($editimg)) echo '<img src="upload/'.$editimg.'" height="40px" width="40px">';?></tD>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submitbtn" value="<?php echo $btn; ?>"></td>
</tr>
</table>
</form><br/><br/>
<?php
if($con)
{
$qry="select * from tbl_user";
$result=mysqli_query($con,$qry);
echo '<table border="1px"><tr><th>ID</th><th>NAME</th><th>EMAIL</th><th>PASSWORD</th><TH>GENDER</TH><TH>ADDRESS</TH><th>COURSE</th><th>Edit</th><th>Delete</th></tr>';
while($row=mysqli_fetch_assoc($result))
{
echo '<tr><td>'.$row['id'].'</td><td>'.$row['fullname'].'</td><td>'.$row['email'].'</td><td>'.$row['password'].'</td><td>'.$row['gen'].'</td><td>'.$row['address'].'</td><td>'.$row['chk'].'</td><tD><img src="upload/'.$row['myfile'].'" height="100px" width="100px"></td><td><a href="form.php?editid='.$row['id'].'">Edit</a></tD><td><a href="form.php?delid='.$row['id'].'">Delete</a></td></tr>';
}
echo '</table>';
}

?>
</center>
</body>
</html>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.