I have created Forms, tried even codes from tutorials (copy & paste), and it doesn't take into consideration the variables.
The first concrete problem is that I can not add data to a database in MySQL from a form. Here is one of the codes I used:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "xxxxxxx","xxxxxxx");
mysql_select_db("test",$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>
This code is from a webpage and it doesn't work. I use PHP 4.3.2.
The second problem is that I can't create a textbox and a button that sends the user to the desired page based on the text in the textbox. This too is a variable problem.
I've just started using PHP and MySQL. A friend told me that this could be that I didn't install or set up correctly PHP or MySQL or Apache.
Could anyone help ???