This is my code so far:
Code: Select all
<HTML>
<?php
if($submit)
{
$db = mysql_connect("localhost", "root","pass");
mysql_select_db("learndb",$db);
$first=$_POST[first];
$last=$_POST[last];
$nickname=$_POST[nickname];
$email=$_POST[email];
$salary=$_POST[salary];
$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES
('$first', '$last', '$nickname','$email','$salary')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
else
{?>
<form method="post" action="input.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Nick Name:<input type="Text" name="nickname"><br>
E-mail:<input type="Text" name="email"><br>
Salary:<input type="Text" name="salary"><br>
<input type="Submit"name="submit" value=" Enter information"></form>
<?
}?>
</HTML>
By the way, my register_globals is set to off which is why I have added the $_POST lines above. I'm sure you guys already knew that but I thought I should add it just in case I have done something wrong.
Thanks everyone.