The problem is in line 53,60,73 and 78. thank you
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<link rel="stylesheet" type="text/css" href="3col_leftNav.css">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Register</title>
</head>
<body>
<?php
if(isset($_POST['btn_Register']))
{
require('connection.php');
$account_id = 'acc-001';
$notification = '';
$v = mysql_query("SELECT account_id from pizzarific.account limit 1");
$x = mysql_affected_rows();
if($x > 0)
{
$row = mysql_fetch_array($v);
$temp = $row['account_id'];
$temp = substr($temp, 4);
$temp = (int)$temp;
$temp++;
$temp = (string)$temp;
if(strlen($temp) == 1)
$account_id = 'acc-00' . $temp;
else if(strlen($temp) == 2)
$account_id = 'acc-0' . $temp;
else
$account_id = 'acc-' . $temp;
}
$v = mysql_query("SELECT * FROM pizzarific.gift_cheque" .
" WHERE gift_cheque_code = '". $giftChequeCode ."'");
$giftChequeCode = $_POST['txt_GiftCheque'];
$v = mysql_query("SELECT * FROM pizzarific.gift_cheque" .
" WHERE gift_cheque_code = '". $giftChequeCode ."'");
$x = mysql_affected_rows();
$name = $_POST['txt_Name']; $address = $_POST['txt_Address'];
$telno = $_POST['txt_TelNo']; $username = $_POST['txt_UserName'];
$pass =$_POST['txt_Pass'];
if($x > 0)
{
try {
$row = mysql_fetch_array($v);
$amount = $row['gift_cheque_amount'];
//this is the part hat is not working
//mysql_query("INSERT INTO `pizzarific`.`account`(`account_id` " .
// ",`name`,`address`,`telno`,`username`,`pass`,`gift_cheque_amount`) VALUES ('"
//. $account_id . "','". $name ."','" . $address ."','"
//. $telno ."','" . $username . "','" . $pass ."',"
//. $amount . ");");
//i tried to insert static contents but no luck
mysql_query("INSERT INTO `pizzarific`.`account`(`account_id`,`name`,`address`,".
"`telno`,`username`,`pass`,`gift_cheque_amount`) VALUES ('acc-003','marina tingson','manunggal','781-0550','marina','password',0);" );
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
$notification = '<BR/><BR/>Gift Cheque Accepted. Registration Successful. Please Login to your Account Now';
}
else
{
if(empty($giftChequeCode))
{
//same as here not working
//$v = mysql_query("INSERT INTO `pizzarific`.`account`(`account_id`,`name`,`address`,".
//"`telno`,`username`,`pass`,`gift_cheque_amount`) VALUES ('" . $account_id . "','" . $name ."','" .
//$address ."','" . $telno ."','" . $username . "','" . $pass ."',0);" );
//again the same as above but not working
mysql_query("INSERT INTO `pizzarific`.`account`(`account_id`,`name`,`address`,".
"`telno`,`username`,`pass`,`gift_cheque_amount`) VALUES ('acc-003','marina tingson','manunggal','781-0550','marina','password',0);" );
}
else
$notification = '<BR/><BR/>Invalid Gift Cheque Code';
}
}
?>
<form id="form1" method="post" target="content">
<label id="Label" >Register Now<br />
</label>
<table style="width: 550px; height: 85px">
<tr>
<td style="width: 189px">Username:</td>
<td style="width: 216px"><input name="txt_UserName" value="<?= $username ?>" type="text" style="height: 20px; width: 128px" /></td>
<td style="width: 119px">Password:</td>
<td><input name="txt_Pass" type="password" value="<?= $password ?>" style="height: 20px; width: 128px" /></td>
</tr>
<tr>
<td style="width: 189px; height: 23px;">Name:</td>
<td style="width: 216px; height: 23px"><input name="txt_Name" value="<?= $name ?>" type="text" style="height: 20px; width: 128px" /></td>
<td style="height: 23px; width: 119px;">Address:</td>
<td style="height: 23px"><input name="txt_Address" value="<?= $address ?>" type="text" style="height: 20px; width: 128px" /></td>
</tr>
<tr>
<td style="width: 189px">Gift Cheque Code:</td>
<td style="width: 216px"><input name="txt_GiftCheque" value="<?= $giftChequeCode ?>" type="text" style="height: 20px; width: 128px"/>*optional</td>
<td style="width: 119px">Telephone No</td>
<td><input name="txt_TelNo" type="text" value="<?= $telno ?>" style="height: 20px; width: 128px" /></td>
</tr>
</table>
 
;
<input name="btn_Register" type="submit" value="Register Now" />
</body>
<label id="Label1"><?= $notification ?></label>
</html>