Insert API/Webservice Using PHP-MYSQL

We will need to create 2 files.
One file would contain the insertion form.

1.Create a form called “signup.php” and put the following code into it.

<html>
<body>
<h1><b>INSERT INQUIRY DETAILS</b></h1>
<form method="POST" action="your/file/path/filename.php">
<table><tr><td>
FIRST NAME:</td><td><input type="text" name="first_name" required></td></tr><tr><td>
LAST NAME:</td><td><input type="text" name="last_name" required></td></tr><tr><td>
PHONE:</td><td><input type="text" name="phone" required></td></tr><tr><td>
EMAIL:</td><td><input type="text" name="email" required></td></tr>
<tr><td>
POSTAL CODE:</td><td><input type="text" name="postal_code" required></td></tr>
<tr><td>
APPOINTMENT DATE/TIME:</td><td><input type="date" name="appointment_date">
<input type="time" name="appointment_time"></td></tr>
<tr>
<td>
<center><input type="submit" value="SUBMIT DETAILS"></center></td>
</tr>
</table>
</form>

<style>
input[type=text], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}

input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}

input[type=submit]:hover {
background-color: #45a049;
}

div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
</body>
</html>

===============================================================
2. Create a file for inserting data into the database.(insert.php)

 

<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

$servername = "localhost"; // yourhostname
$username = "root"; //your username
$password = ""; //yourpassword

$dbh1 = mysql_connect($servername, $username, $password);

mysql_select_db($dbname, $dbh1);

if($_SERVER['REQUEST_METHOD'] == "POST"){
// Get data
$first_name = isset($_POST['first_name']) ? mysql_real_escape_string($_POST['first_name']) : "";
$last_name = isset($_POST['last_name']) ? mysql_real_escape_string($_POST['last_name']) : "";
$email = isset($_POST['email']) ? mysql_real_escape_string($_POST['email']) : "";
$phone = isset($_POST['phone']) ? mysql_real_escape_string($_POST['phone']) : "";
$postal_code = isset($_POST['postal_code']) ? mysql_real_escape_string($_POST['postal_code']) : "";
echo $appointment_date = isset($_POST['appointment_date']) ? mysql_real_escape_string($_POST['appointment_date']) : "";
echo $appointment_time = isset($_POST['appointment_time']) ? mysql_real_escape_string($_POST['appointment_time']) : "";
echo $appointment_date_time = $appointment_date." ".$appointment_time;
if( ! ini_get('date.timezone') )
{
date_default_timezone_set('GMT');
}

$created_date = date('Y-m-d H:i:s');

// Insert data into data base
$sql = "INSERT INTO `inquiry`(`first_name`, `last_name`,`phone`, `email`,`postal_code`, `appointment_date_time`, `appointment_date`, `appointment_time`,`created_date`) VALUES ('$first_name','$last_name','$phone','$email','$postal_code','$appointment_date_time','$appointment_date','$appointment_time','$appointment_notes','$created_date')";
$qur = mysql_query($sql);
$app_res=mysql_query($appointment_sql);
if($qur){
$json = array("status" => 1, "msg" => "Done User added!");
}else{
$json = array("status" => 0, "msg" => "Error adding user!");
}
}else{
$json = array("status" => 0, "msg" => "Request method not accepted");
}

/* Output header */

echo json_encode($json);

?>

214 thoughts on “Insert API/Webservice Using PHP-MYSQL

  1. Pingback: Google
  2. Pingback: VIP Desert Safari
  3. Pingback: Porn City XXX
  4. Pingback: website
  5. Pingback: mail order brides
  6. Pingback: milf dating
  7. Pingback: саврасый
  8. Pingback: rencontres sexe
  9. Pingback: rabbit vibrators
  10. Pingback: Annemarie Börlind
  11. Pingback: app for laptop
  12. Pingback: play free pc games
  13. Pingback: bullet eggs
  14. Pingback: cursos gratuitos
  15. Pingback: Gurgaon
  16. Pingback: gay sex
  17. Pingback: webcambabes
  18. Pingback: sexe webcam
  19. Pingback: prostate toy
  20. Pingback: double sided dildo
  21. Pingback: thick dildo
  22. Pingback: спарыш
  23. Pingback: sex toy store
  24. Pingback: thick dildo
  25. Pingback: top rated strapons
  26. Pingback: using penis pump
  27. Pingback: easy payday loans
  28. Pingback: персть
  29. Pingback: vaginal balls
  30. Pingback: best dildos
  31. Pingback: splorch review
  32. Pingback: best sex games
  33. Pingback: panty vibrator
  34. Pingback: viagra
  35. Pingback: satta matka
  36. Pingback: double vibrator
  37. Pingback: male stroker toy
  38. Pingback: clit vibe
  39. Pingback: g gasm curve
  40. Pingback: adam male toys
  41. Pingback: gay bondage gear
  42. Pingback: porn city
  43. Pingback: porn land
  44. Pingback: butterfly vibrator
  45. Pingback: gay underwear
  46. Pingback: cyberskin stroker
  47. Pingback: male stroker
  48. Pingback: Suan Sunandha
  49. Pingback: suction cup dong
  50. Pingback: rampant rabbit
  51. Pingback: adult toys for men
  52. Pingback: spanking paddle
  53. Pingback: best sex toy 2018
  54. Pingback: bondage kit
  55. Pingback: lingerie
  56. Pingback: look at here
  57. Pingback: Julia Ann
  58. Pingback: bdjobs sign in
  59. Pingback: Pakistani Suits
  60. Pingback: Pentair Ichlor
  61. Pingback: sexboer
  62. Pingback: geile sex filmpjes
  63. Pingback: porno files
  64. Pingback: gratis films
  65. Pingback: pornofilmpjes
  66. Pingback: liteblue login
  67. Pingback: liteblue
  68. Pingback: fingo vibrator
  69. Pingback: dildo
  70. Pingback: outdoors
  71. Pingback: male enhancement
  72. Pingback: hunter hundeseng
  73. Pingback: best nipples
  74. Pingback: beeg bbw
  75. Pingback: large sex toys
  76. Pingback: walmartone.com
  77. Pingback: onewalmartwire.com
  78. Pingback: Bluechew reviews
  79. Pingback: Don Juravin
  80. Pingback: type 1 diabetes
  81. Pingback: bdsm
  82. Pingback: bondage gear
  83. Pingback: gay male sex toys
  84. Pingback: clone my willy
  85. Pingback: podcast
  86. Pingback: judi online
  87. Pingback: best cock rings
  88. Pingback: home decor gifts
  89. Pingback: maxbet indonesia
  90. Pingback: Hotmail login
  91. Pingback: porn free
  92. Pingback: gay men underwear
  93. Pingback: gay man sex toys
  94. Pingback: Brøndby ultras
  95. Pingback: iraniporn
  96. Pingback: free xxx
  97. Pingback: gays and toys

Leave a Reply