Hi, In the HTML forum I asked how I could get the results from a form which I will put on my site via e-mail, I was told: I was then told to come to this forum and ask about the basics of PHP form processing. Any help would be appreciated! Martin
<form action="database.php" method="POST"> firsetname"<br> <input type="text" name="firstname"><br> last name: <input type="text" name="lastname"><br> <input type="submit" value="submit" name="submit"> </form>
<? $name=$_POST['firstname']; $lastname=$_POST['lastname']; $username="your databse username"; $password="your databse password"; $hostname="localhost"; $db=mysql_connect($hostname, $username, $password) or die ("could not connect to database sorry"); $a=mysql_query("insert into tablename(field1,field2)values('$name','$lastname')"); ?>
<? $sel=mysql_query("select * from tablename"); $n1=mysql_num_rows($sel); $i1=0; while($i1<$n1) { $fname=mysql_result($sel,$i1,"field1"); $lname=mysql_result($sel,$i1, "field2"); print $fname; print $lname; $i1++; }