Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("dbconnection.php");
- $msg = '';
- $name = '';
- $fname = '';
- $cont='';
- $gender = '';
- if($_SERVER["REQUEST_METHOD"] == "POST")
- {
- if(isset($_POST['name']))
- $name = $_POST['name'];
- if(isset($_POST['fname']))
- $fname = $_POST['fname'];
- if(isset($_POST['gender']))
- $gender = $_POST['gender'];
- if($name == '')
- {
- $msg = "Name please";
- }
- else if($fname == '')
- {
- $msg = "father Name please";
- }
- else if($gender == '')
- {
- $msg = "Gender please";
- }
- else if($cont == ''){
- $cont = "CONTACT please";
- }
- $sql = "insert into userss (name,father,gender,image)
- values ('".$name."','".$fname."','".$gender."','".$cont."')";
- if ($conn->query($sql) === TRUE )
- {
- echo "New record created successfully";
- }
- else
- {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Add</title>
- </head>
- <body>
- <?php
- if(isset($msg)){echo $msg;} ?>
- <form method="post" action="insertforms.php" >
- Name:
- <input type="text" name="name" value="ahsa"><br>
- username:
- <input type="text" name="user" value="ali asghar"><br>
- Password:
- <input type="text" name="pass" value="ali asghar"><br>
- contact
- <input type="text" name="cont" value="ali asghar"><br>
- Email
- <input type="text" name="email" value="ali asghar"><br>
- Gender :
- <input type="radio" name="rdo" value="ali asghar"><br>
- <input type="radio" name="rdo" value="ali asghar"><br>
- <input type="submit" name="sub">
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment