Guest User

Untitled

a guest
Aug 15th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <?php
  2. $name = $_POST["name"];
  3. $email = $_POST["email"];
  4. $location=$_POST["location"];
  5. $org_category=$_POST["organization_category"];
  6. $org_name=$_POST["organization_name"];
  7. $application_website=$_POST["resource"];
  8. $procedure=$_POST["selection_procedure"];
  9. $eng_stream=$_POST["engineering_stream"];
  10. $domain=$_POST["internship_domain"];
  11. $intern_experience=$_POST["intern_exp"];
  12. $intern_prep=$_POST["preparation"];
  13. $intern_year=$_POST["intern_year"];
  14. $anonymous=$_POST["anonymous"];
  15. $no_of_sub=$_POST["no_of_sub"];
  16. //$dateandtime=now();
  17. $dateandtime=date('Y-m-d H:i:s');
  18. $prof_name=$_POST["professor_name"];
  19. $application_procedure=$_POST["application_procedure"];
  20. $ratingDifficulty=$_POST["ratingDifficulty"]-3;
  21. $learningExp=$_POST["learn"];
  22. $existingKnowledge=$_POST["existing"];
  23.  
  24.  
  25.  
  26. $servername = "mysql11.000webhost.com";
  27. $username = "a4078960_exampre";
  28. $password = "Swagita@1605";
  29. $dbname = "a4078960_exampre";
  30.  
  31. $last_id=0;
  32.  
  33. // Create connection
  34. $conn = new mysqli($servername, $username, $password, $dbname);
  35. // Check connection
  36. if ($conn->connect_error) {
  37.  
  38. die("Connection failed: " .$conn->connect_error);
  39. }
  40. else {
  41.  
  42. }
  43.  
  44.  
  45. $sql = "INSERT INTO Intern
  46. VALUES (NULL,'".$email."' , '".$name."','".$location."', '".$org_category."','".$prof_name."', '".$org_name."', '".$application_website."', '".$application_procedure."','".$procedure."', '".$eng_stream."', '".$domain."', '".$intern_experience."', '".$intern_prep."','".$ratingDifficulty."','".$learningExp."','".$existingKnowledge."','".$intern_year."','".$anonymous."','".$dateandtime."')";
  47.  
  48. if ($conn->query($sql) === TRUE) {
  49. $GLOBALS['last_id'] = $conn->insert_id;
  50. echo "New record created successfully";
  51. } else {
  52. echo "Error: " . $sql . "<br>" . $conn->error;
  53. }
  54.  
  55.  
  56.  
  57. if($_POST["subject0"]!=NULL ||$_POST["question0"]!=NULL)
  58. {
  59. $sqli = "INSERT INTO Intern_Technical VALUES (NULL,'".$GLOBALS['last_id']."','".$_POST["subject0"]."','".$_POST["question0"]."')";
  60. $conn->query($sqli);
  61. }
  62. if($_POST["subject1"]!=NULL ||$_POST["question1"]!=NULL)
  63. {
  64. $sqli = "INSERT INTO Intern_Technical VALUES (NULL,'".$GLOBALS['last_id']."','".$_POST["subject1"]."','".$_POST["question1"]."')";
  65. $conn->query($sqli);
  66. }
  67. if($_POST["subject2"]!=NULL ||$_POST["question2"]!=NULL)
  68. {
  69. $sqli = "INSERT INTO Intern_Technical VALUES (NULL,'".$GLOBALS['last_id']."','".$_POST["subject2"]."','".$_POST["question2"]."')";
  70. $conn->query($sqli);
  71. }
  72. if($_POST["subject3"]!=NULL ||$_POST["question3"]!=NULL)
  73. {
  74. $sqli = "INSERT INTO Intern_Technical VALUES (NULL,'".$GLOBALS['last_id']."','".$_POST["subject3"]."','".$_POST["question3"]."')";
  75. $conn->query($sqli);
  76. }
  77.  
  78. $conn->close();
  79. ?>
Add Comment
Please, Sign In to add comment