Hi all,
The 2 tables are as follows.
account_details (account_number, nic, full_name, name_with_initials, phone_number, address, gender, date_of_birth)
account (account_number, account_type, fd_period, account_balance, account_interest)
In my accounts opening form there are 9 fields. NIC, Full name, Name with initials, Phone number, Address, Gender, DOB, Account Type, FD period
I want to insert data to these 2 tables in my database to proceed furthermore.The below code does not work..
Can anyone show me the error.The error message is,
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\MySite\php files\handlers\account.php on line 46
$query= "UPDATE account `".$_POST['account_type']."` , '"$_POST['fd_period']."' WHERE `account_number`='".$_POST['account_number']."'";
mysql_query($query) or die(mysql_error());
account.php
<form id="form1" name="form1" method="post" action="">
<label>
<input type="submit" name="button" id="button" value="Home" />
</label>
</form>
<p> </p>
<p>
<?php
$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);
//Create Array
$info = array(
'nic' => $_POST["nic"],
'full_name' => $_POST["full_name"],
'name_with_initials' => $_POST["name_with_initials"],
'phone_number' => $_POST["phone_number"],
'address' => $_POST["address"],
'gender' => $_POST["gender"],
'date_of_birth' => $_POST["date_of_birth"],
'account_type' => $_POST["account_type"],
'fd_period' => $_POST["fd_period"]
);
//Prepare the Insert Query
$insert_query = "INSERT INTO account_details (
nic,
full_name,
name_with_initials,
phone_number,
address,
gender,
date_of_birth
)
VALUES
(
'$info[nic]',
'$info[full_name]',
'$info[name_with_initials]',
'$info[phone_number]',
'$info[address]',
'$info[gender]',
'$info[date_of_birth]'
)";
$query= "UPDATE account `".$_POST['account_type']."` , '"$_POST['fd_period']."' WHERE `account_number`='".$_POST['account_number']."'";
mysql_query($query) or die(mysql_error());
//Run a switch on the chosen type of account
if($info['account_type'] == "abhimani_plus") {
if($info['gender']!="female") {
//Show error messages here
echo "You do not meet the critera required to open this account.";exit;
}
}
//Account Creation Here
$r = mysql_query ($insert_query);
if($r) {
echo "A new account with number ".mysql_insert_id()." has been created successfully.";die();
}
?>
</p>
<p> </p>
<p> </p>