Help with this html and PHP codes
Posted: Mon Jun 26, 2006 1:39 pm
Hi people,
Could any anyone help me out with this html and php codes. I keep getting "something went wrong" error message everytime i request the web page from the apache web server.
insert_form.html
----------------
<HTML>
<HEAD>
<TITLE>Insert Form</TITLE>
</HEAD>
<BODY>
<FORM ACTION="insert.php" METHOD=POST>
<P>Text to addbr>
<input type=text name="testField" size=30>
<p><input type=submit name="submit" value="Insert Record"></p>
</FORM>
</BODY>
</HTML>
insert.php
--------
<?php
// open the connection
$olu = mysql_connect("localhost", "root", "olu1bal");
// pick the database to use
mysql_select_db("testDB",$olu);
// create the SQL statement
$sql = "INSERT INTO testTable values ('', '$_POST[testField]')";
// execute the SQL statement
if (mysql_query($sql, $olu)) {
echo "record added!";
} else {
echo "something went wrong";
}
?>
I look 4ward to hearing from anyone a.s.a.p.
black85
Could any anyone help me out with this html and php codes. I keep getting "something went wrong" error message everytime i request the web page from the apache web server.
insert_form.html
----------------
<HTML>
<HEAD>
<TITLE>Insert Form</TITLE>
</HEAD>
<BODY>
<FORM ACTION="insert.php" METHOD=POST>
<P>Text to addbr>
<input type=text name="testField" size=30>
<p><input type=submit name="submit" value="Insert Record"></p>
</FORM>
</BODY>
</HTML>
insert.php
--------
<?php
// open the connection
$olu = mysql_connect("localhost", "root", "olu1bal");
// pick the database to use
mysql_select_db("testDB",$olu);
// create the SQL statement
$sql = "INSERT INTO testTable values ('', '$_POST[testField]')";
// execute the SQL statement
if (mysql_query($sql, $olu)) {
echo "record added!";
} else {
echo "something went wrong";
}
?>
I look 4ward to hearing from anyone a.s.a.p.
black85