I have two files, csform.php and process.php. Csform.php is the main page with the form that a user will enter in the data and hit submit which then I have process.php and the sql connection and I want that data the user entered into the form to be inserted into the sql server database. But when submit is hit the data that is entered into the form is not inserted, the data in line 13 of the process.php file is inserted. What am I doing wrong, is doesn't seem like I have a connection between the two files. Here is the coding I currently have:
csform.php:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSLog</title>
</head>
<h1> Customer Service Form </h1>
<form method="post" action="process.php">
<table width="300" border="0">
<tr>
<td> Forte ID:</td>
<td><select id="forteid" input name="forteid">
<option value="user1">user1</option>
<option value="user2">user2</option>
<option value="user3">user3</option>
<option value="user4">user4</option>
</select></td>
</tr>
<tr>
<td> Disposition</td>
<td><select id="disposition" input name="disposition">
<option value="Save">--Save--</option>
<option value="Sale">--Sale--</option>
<option value="LOC">--LOC--</option>
</select> </td>
</tr>
</table>
<br />
<hr />
<br />
<br />
<table width="400" border="0">
<tr>
<td>App Number:</td>
<td></td>
<td><input type="text" name="appnumber"></td>
</tr>
<tr>
<td>Finance Number:</td>
<td></td>
<td><input type="text" name = "Finance_Num"></td>
</tr>
<tr>
<td>Number Payments:</td>
<td></td>
<td><input type="text" name = "num_payments"></td>
</tr>
<tr>
<td>Ach or CC:</td>
<td></td>
<td><input type="text" name = "ach_cc"></td>
</tr>
<tr>
<td>Date:</td>
<td></td>
<td><input type="text" name = "date"></td>
</tr>
</table>
<br />
Notes:
<br />
<textarea input name="text" id="notes" cols="45" rows="5"></textarea>
</fieldset>
<br />
<br />
<hr />
<br />
<br />
<input type="submit" name="formSubmit" value="Submit"> <input type="Reset" name="formReset" value="Reset">
</form>
</head>
<body>
</body>
</html>
And then the process.php:
<?php
$serverName = 'SRB-Nick_Desktop\SQLEXPRESS';
$connectionInfo = array('Database'=>'cslogs', 'UID'=>'cslogslogin', 'PWD'=>'123456');
$connection = sqlsrv_connect($serverName, $connectionInfo);
if( $connection === false )
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
$tsql = "INSERT INTO logs(ForteID, disposition, appnumber, Finance_Num, num_payments, ach_cc, date, notes) VALUES (?,?,?,?,?,?,?,?)";
$parameters = array( "forteid", "LOC", "NCXXXXXXX4", "SRB-000004", "0", "cc", "2012-11-01", "gave LOC instructions");
$stmt = sqlsrv_query($connection, $tsql, $parameters);
if( $stmt === false ){
echo "Statement could not be executed.\n";
die( print_r( sqlsrv_errors(), true));
} else {
echo "Rows affected: ".sqlsrv_rows_affected( $stmt )."\n";
}
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $connection);
?>
Hopefully someone is able to help me or steer me in the right direction on what I am doing wrong.
