<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<link rel="stylesheet" type="text/css" href="cssepik_pay.css" >
<title>Payment</title>
</head>
<body style=" background-color:grey; border:2px;padding:10px;">
<div class="topnav">
<a href="ergasia06.html">Home</a>
<a class="active" href="form_pay.php">Buy a Book</a>
<a href="form_epik.html">Contact</a>
</div>
<br>
<form autocomplete="yes" action="form_pay.php" method="post" name="form1">
<legend>Payment</legend>
<label style="letter-spacing: 9.5px;" for="onoma">Όνομα:</label>
<input text="Όνομα" type="text" name="onoma" placeholder="name" id="name"><br>
<label style="letter-spacing: 5.25px;" for="epitheto">Επίθετο:</label>
<input placeholder="surname" type="text" id="surname" name="epitheto" ><br>
<label style="letter-spacing: 0.75px;" for="tel">Τηλέφωνο:</label>
<input placeholder="tel." type="text" name="tel" ><br>
<label style="letter-spacing: 13.5px;" for="email">Email:</label>
<input placeholder="example@mail.com" type="email" name="email"><br><br>
<label for="book">Book:</label>
<select name="books" id="books" onchange="changeddl(this)">
<option selected value="20" >Ο Ιγνάτιος και η γάτα : 20 euro.</option>
<option value="30">Η Δόνα Τερηδόνα και το μυστικό της γαμήλιας τούρτας : 30 euro.</option>
<option value="35">O τηγάνι του δήμιου : 35 euro.</option>
<option value="40">Οι χελώνες του Βαρώνου : 40 euro.</option>
</select>
<label for="posotita"> Ποσότητα:</label>
<input required style="font-size:20px;" type="number" name="posotita" placeholder="1">
<br><br>
<label style="letter-spacing: -2.15px;" for="cardExpiry">Ημερομηνία</label>
<input style="color: grey;" type="date" name="hm" placeholder="DD / MM / YY">
<br><br>
<legend>Payment Details:</legend><br>
<img src="visa_master-1.png" > <br>
<input type="radio" name="gender" value="visa" checked> Visa</input> <br>
<input type="radio" name="gender" value="mastercard" > MasterCard</input> <br>
<input type="radio" name="gender" value="WebCard"> WebCard</input>
<br>
<input type="radio" name="gender" value="gram" > MoneyGram</input> <br>
<a style="color:white;font-size:110%;">Or </a>
<a style="color:white;font-size:110%;" href="https://www.paypal.com/gr/signin"target="blank">PayPal</a> <br>
<label style="letter-spacing: 2.50px;" for="cardNumber">CARD NUMBER</label>
<input type="number" oninput="this.value=this.value.slice(0,this.maxLength)" maxlength="16" name="cardNumber" placeholder="Valid Card Number" autocomplete="cc-number" >
<br><br>
<label style="letter-spacing: -1.15px;" for="cardExpiry">EXPIRATION DATE</label>
<input type="month" name="cardExpiry" placeholder="MM / YY">
<br><br>
<label style="letter-spacing: 18px;" for="cardCVC"> CV CODE</label>
<input name="cardCVC" oninput="this.value=this.value.slice(0,this.maxLength)" type="number" maxlength="3" placeholder="CVC">
<br>
<label style="letter-spacing: -1px;" for="cardholderName">CARD HOLDER NAME:</label>
<br>
<input type="text" name="firstname"></input>
<br>
<input type="checkbox" name="save"> <label style="font-size:60%">Save This Card</input>
<br>
<input style="color:grey;height:200px;width:100px" type="submit" onClick="conf()"/>
<input style="color:grey;font-size: 50px;" type="reset" value="Reset">
<br>
</form>
<script type="text/javascript">
function conf()
{
var letters = /^[A-Za-z]+$/;
if(!document.getElementById("name").value.match(letters))
{
alert('Please input alphabet characters only on name!');
return false;
}
if(!document.getElementById("surname").value.match(letters))
{
alert('Please input alphabet characters only on surnname!');
return false;
}
var con=confirm("Do you want to buy for sure?");
if (con==true){
valcheck()
return true;
}
else
{
return false;
}};
function valcheck()
{
var x = document.getElementById("books").selectedIndex + 1;
var posot= document.form1.posotita.value;
var y=0;
var w;
if (posot==0)
{
window.alert("Ποσότητα?");
return false;
}
if (x==1)
{
w="Ο Ιγνάτιος και η γάτα.";
x=20;
}
if (x==2) {
w="Η Δόνα Τερηδόνα και το μυστικό της γαμήλιας τούρτας.";
x=30;
}
if (x==3) {
w="O τηγάνι του δήμιου."
x=35;
}
if (x==4) {
w="Οι χελώνες του Βαρώνου."
x=40;
}
y=x*posot;
window.confirm("Τιμή "+posot+" βιβλίων: "+w+" "+y+"euro!"+"\nΌλες οι χρεώσεις είναι σε ευρώ και υπάρχει επιπλέον χρέωση ΦΠΑ 11%");
};
</script>
<?php
$servername = 'localhost';
$username = 'root';
$password = '';
$dbname = 'dbergasia6';
// make connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// check connection
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error()); }
//charset for greek
mysqli_set_charset($conn, "utf8");
$sql = "SELECT email, titlosvivlion, arvivlion, cardnumber, expdate, cvcode, cardholder, price FROM table1";
if(isset($_POST['submit'])){
echo $email=$_POST['email'];
$books=$_POST['books'];
$posotita=$_POST['posotita'];
$cardNumber=$_POST['cardNumber'];
$ExpDate=$_POST['ExpDate'];
$CvCode=$_POST['CvCode'];
$cardholder=$_POST['CardHolder'];
$Price=$_POST['Price'];}
$sql = "INSERT INTO table1 (email, titlosvivlion, arvivlion, cardnumber, expdate, cvcode, cardholder, price) VALUES ('$email','$books','$posotita','$posotita','$cardNumber','$ExpDate','$CvCode','$cardholder','$Price')";
// header("refresh:10; url=ergasia06.html");
//close connection
mysqli_close($conn);
?>
</body>
</html>
我收到未定义的可变电子邮件,titlosvivlion,arvivlion,卡号,expdate,cvcode,持卡人,价格的错误 但这是我数据库中表格的行
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的电子邮件
通知:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的书
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的posotita
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的posotita
通知:未定义的变量:/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php在第161行的
注意:未定义的变量:第161行的/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的ExpDate
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的CvCode
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的持卡人
注意:未定义的变量:第161行/Applications/XAMPP/xamppfiles/htdocs/php_labs/ergasia6/form_pay.php中的价格