Forum Moderators: coopster
<?
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter(); $db_name ="web13_adsadsa";
$table_name ="details1";
$server = "localhost";
$dbusername = "web13_asdsadsadsa";
$dbpassword = "asdsadsadsadsadsdas";
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
$un = $_POST['un'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$dob = $_POST['dob'];
$bcl= $_POST['bcl'];
$whereborn= $_POST['whereborn'];
$nsn = $_POST['nsn'];
$md = $_POST['md'];
$wheremarried = $_POST['wheremarried'];
$mc1 = $_POST['mc1'];
$mc2 = $_POST['mc2'];
$nextofkin = $_POST['nextofkin'];
$query = "INSERT INTO details1 ('un', 'name', 'phone', 'email', 'dob', 'bcl', 'whereborn', 'nsn', 'md', 'wheremarried', 'mc1', 'mc2', 'nextofkin')
values ('&un', '&name', '$phone', '$email', '$dob', '$bcl', '$whereborn', '$nsn', '$wheremarried', '$mc1', '$mc2', '$nextofkin')"
or die(mysql_error());
header('Location:../index.htm');
?>
the script sends you to index.htm but doesnt insert anything into the db and yes the un and pw e.t.c. are correct.
Regards
Walker
Anyway ive played around and looked at other workign codes
and got this now
<?
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter(); $db_name ="erm";
$table_name ="details1";
$server = "localhost";
$dbusername = "erm";
$dbpassword = "erm";
$connection = mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = mysql_select_db($db_name,$connection)or die(mysql_error());
$un = $_POST['un'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$dob = $_POST['dob'];
$bcl= $_POST['bcl'];
$whereborn= $_POST['whereborn'];
$nsn = $_POST['nsn'];
$md = $_POST['md'];
$wheremarried = $_POST['wheremarried'];
$mc1 = $_POST['mc1'];
$mc2 = $_POST['mc2'];
$nextofkin = $_POST['nextofkin'];
$sql = "INSERT INTO $table_name ('un', 'name', 'phone', 'email', 'dob', 'bcl', 'whereborn', 'nsn', 'md', 'wheremarried', 'mc1', 'mc2', 'nextofkin')
values ('$un', '$name', '$phone', '$email', '$dob', '$bcl', '$whereborn', '$nsn', '$wheremarried', '$mc1', '$mc2', '$nextofkin')";
$result = @mysql_query($sql,$connection) or die(mysql_error());
header('Location:../index.htm');
?>
$sql ="SELECT * FROM $table_name WHERE username= '$_POST[username]'";
basically all i want to do is wack everything from the form into a database im not bothered about checking it against a username / password i just want it to go into the table under the correct hendings.
Cheers