
April 27th, 2000, 11:00 PM
|
|
Junior Member
|
|
Join Date: Apr 2000
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
i copied & paste an example from webmonkey and get this error on th browser:
'Warning: Uninitialized variable or array index or property (submit) in /home/httpd/html/php/dbform3.php3 on line 4'
the code:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root","trickle");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>
how do I get rid off the warning message?
tia.
|