0
hello I have this table named Payment:
fname
adr
city
cname
ccnum
expmonth
expyear
cvv
id
and I have this payment form if the person wants to help my project!
<form id="my-form"
action="envia.php"
method="POST"> <label for="fname"><i class="fa fa-user"></i> Nome</label>
<input type="text" id="fname" name="firstname" placeholder="seu nome e sobrenome">
<label for="email"><i class="fa fa-envelope"></i> Email</label>
<input type="text" id="email" name="email" placeholder="[email protected]">
<label for="adr"><i class="fa fa-address-card-o"></i> Address</label>
<input type="text" id="adr" name="address" placeholder="542 W. 15th Street">
<label for="city"><i class="fa fa-institution"></i> City</label>
<input type="text" id="city" name="city" placeholder="New York">
<label for="cname">Name on Card</label>
<input type="text" id="cname" name="cardname" placeholder="John More Doe">
<label for="ccnum">Numero do Cartão:</label>
<input type="number" id="ccnum" name="cardnumber" placeholder="1111-2222-3333-4444" >
<label for="expmonth">Mês de Expiração:</label>
<input type="number" id="expmonth" name="expmonth" placeholder="Setembro">
<label for="expyear">Exp Year</label>
<input type="number" id="expyear" name="expyear" placeholder="2018" pattern="[0-9]+$">
<label for="cvv">CVV</label>
<input type="number" id="cvv" name="cvv" placeholder="352">
<button id="my-form-button" >Submit</button>
in send.php I have this code:
<?php
session_start();
include_once("conexao.php");
$firstname = $_POST["firstname"];
$email =$_POST["email"];
$address = $_POST["address"];
$city = $_POST["city"];
$cardname = $_POST["cardname"];
$cardnumber = $_POST["cardnumber"];
$expmonth = $_POST["expmonth"];
$expyear = $_POST["expyear"];
$cvv = $_POST["cvv"];
$result_usuario = "INSERT INTO Payment (fname, email, adr, city, cname, ccnum , expmonth , expyear , cvv , id) VALUES ('$firstname', '$email', '$firstname','$address', '$city','$cardnumber','$cardname','$expmonth','$expyear','$cvv',NOW())";
$resultado_usuario = mysqli_query($conn, $result_usuario);
//sucesso
if(mysqli_insert_id($conn)){
$_SESSION['msg'] = "<p style='color:green;'>Usuário cadastrado com sucesso</p>";
header("Location: cadastrado.php");
//erro
}else{
$_SESSION['msg'] = "<p style='color:red;'>Usuário não foi cadastrado com sucesso</p>";
header("Location: error.php");
}
and in connection.php:
<?php $servidor = "localhost"; $usuario = "meu_usuario"; $senha =
"minha_senha"; $dbname = "nome_do_meu_banco"; $conn = mysqli_connect($servidor, $usuario, $senha,
$dbname);
only that he’s not recording anything that’s wrong?
Give an echo in the $result_usuario variable and try to run the query in the database
– Felipe Pacheco Paulucio
did debug? identified an error? with @Felipepachecopaulucio said, tried to pick up the query and see if it is ok?
– Ricardo Pontual