Only the email
and telephone
data fields are being populated in the DB.
firstName
, lastName
, and changeRequest
are not being populated.
I am getting the message "Form Submitted".
<html>
<body bgcolor="99ccff">
<head>
<title>Change Request</title>
</head>
<h1>Submitting Change Request</h1>
<p>Change Request</p>
<form name="htmlform" method="post" action="html_form_send.php">
<table width="450px">
</tr>
<tr>
<td valign="top">
<label for="first_name">First Name *</label>
</td>
<td valign="top">
<input type="text" name="firstName" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="last_name">Last Name *</label>
</td>
<td valign="top">
<input type="text" name="lastName" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email Address *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Telephone Number</label>
</td>
<td valign="top">
<input type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="changeRequest">Change Request *</label>
</td>
<td valign="top">
<textarea name="changeRequest" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
<
</body>
</html>
html_form_send.php
<?php
define('DB_NAME', 'mytestdb');
define('DB_USER', 'root');
define('DB_PASS', '7vMUgtEU8NnU');
define('DB_HOST', 'localhost');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
if (!$link) {
dir('There was a problem when trying to connect to the host. Please contact Tech Support. Error: ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$link) {
dir('There was a problem when trying to connect to the database. Please contact Tech Support. Error: ' . mysql_error());
}
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$changeRequest = $_POST['changeRequest'];
$sql = "INSERT INTO changeRequest (firstName, lastName, email, telephone, changeRequest) VALUES ('$firstName', '$lastName', '$email', '$telephone', '$changeRequest')";
if (!mysql_query($sql)) {
die('Error: ' . mysql_error());
}
echo "<p>Form Submitted</br>";
?>