<BODY>
<H1>LexiconDB</H1>
<?php
$link = mysql_connect();
mysql_drop_db("LexiconDB",$link);
mysql_create_db("LexiconDB",$link);
mysql_select_db("LexiconDB",$link);
$query = "CREATE TABLE english
(
TermID INTEGER NOT NULL,
Term VARCHAR(32) NOT NULL,
soundex VARCHAR(32)
);";
if(!mysql_query($query,$link))
{
echo "false";
}
function Insert_Value($TermID_var,$Term_var,$link)
{
$soundex_var = soundex($Term_var);
$query = "INSERT INTO english
VALUES ('$TermID_var','$Term_var','$soundex_var');";
$result=mysql_query($query);
if($result)
{
echo mysql_affected_rows()."record inserted.";
}
mysql_close($LexiconDB);
}
//Insert_Value(1,"salinity",$link);
echo'
<FORM METHOD ="POST" ACTION="Insert_Value($TermID_var)">
<DIV ALIGN="center"><CENTER>
<H2>Please enter a new word:<INPUT TYPE="text" NAME="term" SIZE="20"></P></H2>
<INPUT TYPE="submit" VALUE="submit word">
<INPUT TYPE="reset" VALUE="reset word">
</FORM>
';
if($REQUEST_METHOD=="POST")
{
Insert_Value(1,"salinity",$link);
}
?>
</BODY>
I have the above code which creates a table named English with 3 variables (TermID_var,TermID,soundex).
I want through the form at the end to be able to enter new word under the TermID column.
My form is fine with one line of text but when i try to view the new details in the database, nothing exists.
Please, any advise would be good!