Hi all,
just started to try and teach meself this thing for the website so I thought Id have a go at a ridiculously easy calendar thing but no matter what I do or how much I google I cant suss whats up.
Heres what I have so far:
A MySQL database called peasepu_whowhere which contains 1 table called items which in turn has 4 fields called who, when, loc & killby
A file called testphp.php which is
I know the connection is working because if I change the myusername slightly I get a cant connect error.
and then insert.php containing :
I dont get any error messages or anything strange, just nothing happens, no records are added to the table.
just started to try and teach meself this thing for the website so I thought Id have a go at a ridiculously easy calendar thing but no matter what I do or how much I google I cant suss whats up.
Heres what I have so far:
A MySQL database called peasepu_whowhere which contains 1 table called items which in turn has 4 fields called who, when, loc & killby
A file called testphp.php which is
Code:
<html>
<head><title>Get data</title></head>
<body>
<?php
$dbh=mysql_connect ("localhost",myusername,mypassword) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("peasepu_whowhere");
?>
<form action="insert.php" method="post">
Who: <input type="text" name="person"><br>
Where: <input type="text" name="place"><br>
When: <input type="text" name="datethere"><br>
Kill date: <input type="text" name="leavetill"><br>
<input type="Submit">
</form>
</body>
</html>
I know the connection is working because if I change the myusername slightly I get a cant connect error.
and then insert.php containing :
Code:
<html>
<head><title>Insert a record</title></head>
<body>
<?php
$per=$_POST['person'];
$place=$_POST['place'];
$datethere=$_POST['datethere'];
$leavetill=$_POST['leavetill'];
$sql = "INSERT INTO `items` (`who`, `when`, `loc`, `killby`) VALUES ($per, $place,$datethere, $leavetill )";
mysql_query($sql);
?>
</body>
</html>
I dont get any error messages or anything strange, just nothing happens, no records are added to the table.