Hello all. First, let me preface my question with a bit of personal info. I am only a beginner when it comes to PHP so this question may be very simple, but I'm stumped. I appreciate any assistance, but please keep it as straightforward as possible:
Ok, here's my question.
I'm working with a form on one page where the user types in a name and a date. (It's only a two field form).
On the next page, I want to print out various information from a table, from the record where the name and date specified on the form exist.
I'm assuming this involves passing a variable from the form to the next page, reading that variable, then echoing back information that is relative to the passed variables.
My form action is "getinfo.php" and on "getinfo.php" my code looks like this . . .
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("test1" ,$db);
if ($name) {
$result = mysql_query("SELECT * FROM people WHERE name=$name and date=$date", $db);
$myrow = mysql_fetch_array($result);
echo "<b>$myrow[lastname], $myrow[firstname]</b>";
}
?>
All i want to do is echo a first and last name stored in the record where the values "name" and "date" (fields in the database) match with what the user typed into the form on the previous page. What am I doing wrong, and does someone know a very easy way to do this? I'm sure it's just a matter of correctly passing a variable between pages, but I can't figure it out.
Thanks in advance.
Andrew