我有这样的表格:
<form name="htmlform" method="post" action="script/gen.php?postData">
<table width="450px">
</tr>
<tr>
<td valign="top">
<label for="customer">Customer:</label>
</td>
<td valign="top">
<input type="text" name="customer" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="nol">Number of licences: </label>
</td>
<td valign="top">
<input type="text" name="nol" maxlength="50" size="30">
</td>
</tr>
<tr>
<td>
<form method="post" id="submit" action="script/gen.php">
<input type="button" onClick="getKey()"; value="Generate key"/>
</td>
</tr>
<div id="innhold">
<h4>Licence Key: </h>
</div>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
感兴趣的代码行是:
<input type="text" name="nol" maxlength="50" size="30">
和
<input type="text" name="customer" maxlength="50" size="30">
我尝试将此信息写入这样的数据库:
function postData($key1) {
//just to check if the key is equal to the one thats posted to the user
//echo '<h5>From postData' . $key1 . '</h5>';
/*echo '<script type="text/javascript"> alert("The order has been submitted successfully");
location = "/Webpanel/index.html";
</script>';*/
$customerVar = $POST['customer'];
$nolVar = $POST['nol'];
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("licencedatabase");
$query_add = "INSERT INTO licence (`customer_name`,`licence_count`) VALUES ('$customerVar','$nolVar')";
$query_exec = mysql_query($query_add) or die(mysql_error());
mysql_close();
}
但我不断收到错误:
Undefined variable: POST
我怎样才能做到这一点?提前致谢。