I am creating a registration form for my school's event, but being very new to PHP and database makes it a hard work for me.
The problem is that the form submits blank data to the table. I can see that there is a new row created upon every submission, but the data is blank.
Here is the code:
Part of form in index.html
<form action="input.php" method="post">
<p>
<input name="prefix" type="radio" id="male"/>
<label for="male">นาย/เด็กชาย</label>
</p>
<p>
<input name="prefix" type="radio" id="female"/>
<label for="female">นางสาว/เด็กหญิง</label>
</p>
<div class="row">
<div class="col s12">
<div class="input-field col s12 m6">
<input id="firstname" type="text" class="validate"/>
<label for="firstname">ชื่อ</label>
</div>
<div class="input-field col s12 m6">
<input id="lastname" type="text" class="validate"/>
<label for="lastname">นามสกุล</label>
</div>
.
.
.
.
<button class="btn btn-large waves-effect waves-light red accent-4" type="submit" name="submit">ส่ง</button>
</form>
input.php
<?php
mysql_connect("localhost", "acsp", "passwordhidden");
mysql_select_db("logicgames");
$order = "INSERT INTO data_logicgames (prefix, firstname, lastname, phone, school, teammate1, teammate2, games, division) VALUES ('$prefix', '$firstname', '$lastname', '$phone', '$school', '$teammate1', '$teammate2', '$games', '$division')";
$result = mysql_query($order);
if ($result) {
echo "<p>Success</p>";
} else {
echo "<p>Failed</p>";
}
?>