
April 16th, 2003, 08:39 AM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 9
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
PHP Code:
<?php include("Auth.php"); ?>
<head>
<title>CWD</title>
</head>
<body bgcolor="white">
</body>
<?
//------Database Login-----------//
$dbuser = 'root';
$dbhost = 'localhost';
$dbpass = 'pass';
$dbname = 'db';
$dbtable = 'record';
//------ DATABASE CONNECTION --------//
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
//pick the database to use
mysql_select_db($dbname,$conn);
$thedate = date('Y-m-d', strtotime($_POST[date]));
//create the SQL statement
$sql = "INSERT INTO $dbtable values ('', '$_POST[Counselor]', '$_POST[f_name]',
'$_POST[l_name]', '$thedate', '$_POST[Meth]', '$_POST[Sex]', '$_POST[Facility]',
'$_POST[SessType]', '$_POST[NoShow]', '$_POST[BAL]', '$_POST[Length]',
'$_POST[LOC]', '$_POST[IndSess]', '$_POST[FileLoc]', '$_POST[GroupSess]',
'$_POST[CD]', '$_POST[Comments]', '$_POST[InsMed]','$_POST[SlidingFee]',
'$_POST[AmtPaid]', '$_POST[PayAgree]', '$_POST[NonPay]')";
//execute the SQL statement
if (mysql_query($sql, $conn)) {
echo "<p>Record $_POST[f_name] $_POST[l_name] Added Successfully<br>";
echo '<a href="new_form.php">Add Another Record</a>';
} else {
echo "<p>Contact Administrator <strong>tech@tech.org</strong>, Error Saving Record";
}
?>
here is a example of the add record code. say I want to make it so if 'f_name' = Nick then it will not add the record. how do I get this to work, I cant seem to figure it out.
|