lundi 27 avril 2020

Cannot POST/ form.php

I've been trying to make a simple POST to insert data to a MySQL database but keep getting the cannot post error. I've tried everything please help. At first it worked but then it suddenly stopped. Can't see to understand why.

<form class="form-horizontal" action="form.php" enctype="multipart/form-data" method="post">
    <fieldset id="account">
      <legend>Your Personal Details</legend>
      <div class="form-group required">
        <label for="input-firstname" class="col-sm-2 control-label">First Name</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="input-firstname" placeholder="First Name" name="name">
        </div>
      </div>
      <div class="form-group required">
        <label for="input-lastname" class="col-sm-2 control-label">Last Name</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="input-lastname" placeholder="Last Name"  name="lastname">
        </div>
      </div>
      <div class="form-group required">
        <label for="input-email" class="col-sm-2 control-label">E-Mail</label>
        <div class="col-sm-10">
          <input type="email" class="form-control" id="input-email" placeholder="E-Mail"  name="email">
        </div>
        <div>
          <input type="submit" value="Submit">
          </div>
      </div>

This is the php file

<?php

include_once 'connection.php';

mysqli_set_charset($dbconnection,"utf8");


if(isset($_POST['Submit']))
{


    $name = $_POST['name'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];


    $query = "INSERT INTO customer (first_name, last_name, email, password) VALUES ('$name','$lastname','$email','loquesea')";


    mysqli_query($dbconnection, $query);

    echo 'lo hicimos!';
}
echo 'mala tuya';



Aucun commentaire:

Enregistrer un commentaire