下面是代码。无论我做了什么都无法连接到wampserver中phpadmin中的mysql数据库,所有尝试都失败了,请帮助解决
if (isset($_POST['continue'])) {
$j=0;
while ($j < $passengers)
{
$register_data2 = array(
'first_name' => $_POST["fname"][$j],
'last_name' => $_POST["lname"][$j],
'passport' => $_POST["passport"][$j],
'visa' => $_POST["visa"][$j],
'address1' => $_POST["address1"][$j],
'address2' => $_POST["address2"][$j],
'email' => $_POST["email"][$j],
'contact' => $_POST["contact"][$j],
'pin' => $_POST["pin"][$j],
'leaving_from' => $pieces[0],
'going_to' => $pieces[2],
'depart_date' => $pieces[7],
'depart_time' => $pieces[12],
'arrival_time' => $pieces[17],
'grand_fare' => $pieces[22],
'returning_from' => $pieces1[0],
'returning_to' => $pieces1[2],
'returning_date' => $pieces1[7],
'returning_time' => $pieces1[11],
'reaching_time' => $pieces1[16],
'fare' => $pieces1[21]
);
session_start();
$_SESSION['ticket'][] = $_POST["fname"][$j];
$_SESSION['ticket'][] = $_POST["lname"][$j];
$_SESSION['ticket'][] = $_POST["passport"][$j];
$_SESSION['ticket'][] = $_POST["visa"][$j];
$_SESSION['ticket'][] = $_POST["pin"][$j];
register_passenger($register_data2);
$j = $j+1;
}
$_SESSION['ticket1'] = $pieces[0];
$_SESSION['ticket2'] = $pieces[2];
$_SESSION['ticket3'] = $pieces[7];
$_SESSION['ticket4'] = $pieces[12];
$_SESSION['ticket5'] = $pieces[17];
$_SESSION['ticket6'] = $pieces[22];
$_SESSION['ticket11'] = $pieces1[0];
$_SESSION['ticket22'] = $pieces1[2];
$_SESSION['ticket33'] = $pieces1[7];
$_SESSION['ticket44'] = $pieces1[11];
$_SESSION['ticket55'] = $pieces1[16];
$_SESSION['ticket66'] = $pieces1[21];
}
?>
<?php
if (isset($_POST['pay'])){
if ($_POST['cash'] != $grand_total) {
echo "*Pay the given amount!"."<br>";
}
else{
header ('Location: ticket.php');
}
}
?>
<h2> Select payment method </h2>
<form action="payment.php" method="post">
<input type="radio" name="payment" id="cash" checked="checked" value="cash">
<label for="cash">Cash</label>
<input type="number" id="cash" name="cash" size="8"><br><br>
<input type="radio" name="payment" id="card" value="card">
<label for="card">Card</label>
<select>
<option>Debit card</option>
<option>Credit card</option>
</select>
<br>
<img src="Credit.jpg">
<br>
<input type="submit" name="pay" value="Make payment">
</form>
<?php
if(isset($_POST["Continue"])){
$firstname = $_POST['fname'];
$lastname = $_POST['lname'];
$passport = $_POST['passport'];
$visa = $_POST['visa'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$pin = $_POST['pin'];
mysql_query( "INSERT INTO passengers (first_name,last_name,passport,visa,address1,address2,email,contact,pin) VALUES('$lastname','$passport','passport','$visa','$address1','$address2','$email','$contact','$pin')");
}
?>
我无法将数据连接到wampserver中phpadmin中的mysql数据库。什么也没发现。正如你在下面所看到的,我多次试图纠正,使之成为失败。我尝试的方法中没有一种不起作用。请帮助解决这个问题
1条答案
按热度按时间elcex8rz1#
你好像把价值观列表搞砸了:
名字不见了,“passport”不应该在那里,等等。应该是: