sushma_proach

form

Apr 7th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> form </title>
  5. <body>
  6. <form action="action.php" method="POST">
  7. name<input type="text" name="name"/><br>
  8. email<input type="text" name="email"/><br>
  9. message<textarea rows="2" col="20" name="message"> </textarea><br>
  10. <input type="submit" name ="submit"
  11. value="submit"/>
  12. </form>
  13.  
  14. <?php
  15.    $dbhost = 'localhost';
  16.    $dbuser = 'root';
  17.    $dbpass = '';
  18.    $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
  19.    if(! $conn )
  20.    {
  21.      die('Could not connect: ' . mysql_error());
  22.    }
  23.    
  24.    echo 'Connected successfully';
  25.    mysqli_select_db($conn,'neha');
  26. ?>
  27.  
  28. <?php
  29. include("db.php");
  30. if(isset($_POST['submit'])){
  31.  $name=$_POST['name'];
  32.      $email=$_POST['email'];
  33.      $message=$_POST['message'];
  34.     echo $sql="INSERT INTO rana". "(name, email, message)". "VALUES". "('$name', '$email','$message')";
  35.     mysqli_query($conn,$sql);
  36. }
  37. ?>
Add Comment
Please, Sign In to add comment