単純なデータベースを作成していますが、なぜ機能しないのかわかりません。[送信] ボタンをクリックしても、テーブルが作成されず、データベースにデータが保存されません。
エラーレポートが表示されないため、何が問題なのかわかりません。
これが私のコードです。
<?php // CONTROLLED PAGE
require_once('pdsACcontrolled.php'); //includes my DB connection
$surnamex = $_POST["surname"];
$firstnamex = $_POST["firstname"];
$middlenamex = $_POST["middlename"];
$nameextensionx = $_POST["nameextension"];
$bdatex = $_POST["bdate"];
$bplacex = $_POST["bplace"];
$sexx = $_POST["sex"];
$civstatx = $_POST["civstat"];
$citizenshipx = $_POST["citizenship"];
$heightx = $_POST["height"];
$weightx = $_POST["weight"];
$bloodtypetx = $_POST["bloodtype"];
$gsisnox = $_POST["gsisno"];
$pagibignox = $_POST["pagibigno"];
$philhealthnox = $_POST["philhealthno"];
$sssx = $_POST["sssno"];
$resaddx = $_POST["resadd"];
$zipcodex = $_POST["zipcode"];
$telnox = $_POST["telno"];
$emailaddx = $_POST["emailadd"];
$cellnox = $_POST["cellno"];
$agencynox = $_POST["agencyno"];
$tin = $_POST["tin"];
$uid = mysql_real_escape_string($uid);
if($_POST['submitbutton'] == "submit")
{
$sql = "CREATE TABLE $uid
( _key INT NOT NULL AUTO_INCREMENT
, surname TEXT(50) NOT NULL DEFAULT '?'
, firstname TEXT(50) NOT NULL DEFAULT '?'
, middlename TEXT(50) NOT NULL DEFAULT '?'
, nameextension TEXT(50) NOT NULL DEFAULT '?'
, bdate DATE NOT NULL DEFAULT '?'
, bplace TEXT(200) NOT NULL DEFAULT '?'
, sex TEXT NOT NULL DEFAULT '?'
, civstat TEXT NOT NULL DEFAULT '?'
, citizenship TEXT(50) NOT NULL DEFAULT '?'
, height INT(10) NOT NULL DEFAULT '?'
, weight INT(10) NOT NULL DEFAULT '?'
, bloodtype TEXT(50) NOT NULL DEFAULT '?'
, gsisno TEXT(50) NOT NULL DEFAULT '?'
, pagibigno TEXT(50) NOT NULL DEFAULT '?'
, philhealthno TEXT(50) NOT NULL DEFAULT '?'
, sssno TEXT(50) NOT NULL DEFAULT '?'
, resadd TEXT(500) NOT NULL DEFAULT '?'
, zipcode TEXT(50) NOT NULL DEFAULT '?'
, telno INT(20) NOT NULL DEFAULT '?'
, emailadd TEXT(50) NOT NULL DEFAULT '?'
, cellno int(20) NOT NULL DEFAULT '?'
, agencyno TEXT(50) NOT NULL DEFAULT '?'
, tin TEXT(50) NOT NULL DEFAULT '?'
, PRIMARY KEY (_key))";
$query="INSERT INTO $uid(surname,firstname,middlename,nameextension,bdate,bplace,sex,civstat,citizenship,height,weight,bloodtype,gsisno,pagibigno,philhealthno,sssno,resadd,zipcode,telno,emailadd,cellno,agencyno,tin)VALUES('$surnamex','$firstnamex','$nameextensionx','$bdatex','$bplacex','$sexx','$civstatx','$citizenshipx','$heightx','$weightx','$bloodtypex','$gsisnox','$pagibignox','$philhealthnox','$sssnox','$resaddx','$zipcodex','$telnox','$emailaddx','$cellnox','$agencynox','$tinx')";
mysql_query($query) or die (mysql_error());
echo "The user $uid has been succesfully registered.";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>
Online PDS | Personal Info
</title>
<script src="pdsjavascript.js"></script>
<link rel="stylesheet" type="text/css" href="pdscss.css">
</head>
<body>
<center>
<form method='POST' action='pdsformpersonalinfo.php'>
<table border=1 cols='3' width='500px'>
<tr><td colspan='3' id='titlehead' class='head'>I. PERSONAL INFORMATION</td></tr>
<tr><td><font color='red' size='3'>*</font>SURNAME</td><td>:</td><td><input type='text' name='surname' size='30' maxlength='50' required='required' class=''></td></tr>
<tr><td><font color='red' size='3'>*</font>FIRST NAME</td><td>:</td><td><input type='text' name='firstname' size='30' maxlength='50' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>MIDDLE NAME</td><td>:</td><td><input type='text' name='middlename' size='30' maxlength='50' required='required'></td></tr>
<tr><td>NAME EXTENSION</td><td>:</td><td><input type='text' name='nameextension' size='30' maxlength='50'></td></tr>
<tr><td><font color='red' size='3'>*</font>DATE OF BIRTH(mm/dd/yyyy)</td><td>:</td><td><input type='date' name='bdate' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>BIRTHPLACE</td><td>:</td><td><input type='text' name='bplace' size='30' maxlength='200' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>SEX</td><td>:</td><td>Male <input type='radio' name='sex' value='Male' required='required'> Female <input type='radio' name='sex' value='Female' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>CIVIL STATUS</td><td>:</td><td><input type='radio' name='civstat' value='Single' required='required' onclick='document.getElementById("civstaton").setAttribute("disabled","disabled");document.getElementById("civstaton").value = "";'> Single
<br><input type='radio' name='civstat' value='Married' required='required' onclick='document.getElementById("civstaton").setAttribute("disabled","disabled");document.getElementById("civstaton").value = "";'> Married
<br><input type='radio' name='civstat' value='Annuled' required='required' onclick='document.getElementById("civstaton").setAttribute("disabled","disabled");document.getElementById("civstaton").value = "";'> Annuled
<br><input type='radio' name='civstat' value='Widowed' required='required' onclick='document.getElementById("civstaton").setAttribute("disabled","disabled");document.getElementById("civstaton").value = "";'> Widowed
<br><input type='radio' name='civstat' value='Seperated' required='required' onclick='document.getElementById("civstaton").setAttribute("disabled","disabled");document.getElementById("civstaton").value = "";'> Seperated
<br><input type='radio' name='civstat' required='required' onclick='document.getElementById("civstaton").removeAttribute("disabled");'> Others,
please specify here<br><input type='text' name='civstat' size='30' id='civstaton' disabled required='required'></td>
</tr>
<tr><td><font color='red' size='3'>*</font>CITIZENSHIP</td><td>:</td><td><input type='text' name='citizenship' size='30' maxlength='50' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>HEIGHT (meter)</td><td>:</td><td><input type='number' name='height' size='30' maxlength='10' min='0' max='18' step='0.1' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>WEIGHT (kilogram)</td><td>:</td><td><input type='number' name='weight' size='30' maxlength='10' min='0' max='300' step='0.1' required='required'></td></tr>
<tr><td><font color='red' size='3'>*</font>BLOOD TYPE</td><td>:</td><td><input type='text' name='bloodtype' size='30' maxlength='50' required='required'></td></tr>
<tr><td>GSIS ID NUMBER</td><td>:</td><td><input type='text' name='gsisno' size='30' maxlength='50'></td></tr>
<tr><td>PAG-IBIG ID NUMBER</td><td>:</td><td><input type='text' name='pagibigno' size='30' maxlength='50'></td></tr>
<tr><td>PHILHEALTH NUMBER</td><td>:</td><td><input type='text' name='philhealthno' size='30' maxlength='50'></td></tr>
<tr><td>SSS NUMBER</td><td>:</td><td><input type='text' name='sssno' size='30' maxlength='50'></td></tr>
<tr><td><font color='red' size='3'>*</font>RESIDENTIAL ADDRESS</td><td>:</td><td><textarea name='resadd' style='width:215px;height:100px;' maxlength='500' wrap='physical' style='resize:none' required='required'></textarea></td></tr>
<tr><td><font color='red' size='3'>*</font>ZIP CODE</td><td>:</td><td><input type='text' name='zipcode' size='30' maxlength='50' required='required'></td></tr>
<tr><td>TELEPHONE NUMBER</td><td>:</td><td><input type='tel' name='telno' size='30' maxlength='50'></td></tr>
<tr><td>E-MAIL ADDRESS(if any)</td><td>:</td><td><input type='email' name='emailadd' size='30' maxlength='50'></td></tr>
<tr><td>CELLPHONE NUMBER(if any)</td><td>:</td><td><input type='tel' name='cellno' size='30' maxlength='50'></td></tr>
<tr><td>AGENCY EMPLOYEE NUMBER</td><td>:</td><td><input type='text' name='agencyno' size='30' maxlength='50'></td></tr>
<tr><td>TIN</td><td>:</td><td><input type='text' name='tin' size='30' maxlength='50'></td></tr>
<tr><td colspan='3'><font color='red' size='5'>*</font>Required fields<center> <input type='submit' name='submitbutton' value='Next'>    <input type='reset' value='Reset'></center></td></tr>
</table>
</form>
</center>
</body>
</html>