I am having trouble Maybe I just stared at it for too long. I hope one of you could help Please
Heres the code:
<? include("conn.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
// form not yet submitted
if (!$submit)
{
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
?>
<font size="+2">PLEASE MAKE SURE YOU FILL OUT EVERY FIELD IN THIS FORM</FONT><BR><BR>
<FORM METHOD="POST" action="<?=$PHP_SELF; ?>">
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<table width="78%" cellspacing="0" cellpadding="2" border="0">
<tr><font size="+1">Customer Information</font><br><br>
<td colspan="4">Focal Circuit ID. <input type="text" name="cir_id" size="16"></td>
</tr>
<tr>
<td colspan="4">Focal Customer Name <input type="text" name="cust_name" size="30"></td>
</tr>
<tr>
<td colspan="4">Customer Contact <input type="text" name="cust_contact" size="30"></td>
</tr>
<tr>
<td>Customer Phone #<INPUT TYPE="text" NAME="cust_phone" MAXLENGTH=12 SIZE="12" value="xxx-xxx-xxxx"></td>
<td>Extension<INPUT TYPE="text" NAME="ext" MAXLENGTH=5 SIZE="4" value="xxxx"></td>
<td>Alternate contact device <select NAME="altphone">
<?
// get alternate phone list
$query = "SELECT id, phonelist from phonelist";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $phonelist) = mysql_fetch_row($result))
{
echo "<option value=$id>$phonelist</option>";
}
mysql_free_result($result);
?>
</select></td>
<td>Phone Number<INPUT TYPE="text" NAME="phone" MAXLENGTH=12 SIZE="12" value="xxx-xxx-xxxx"></td>
</tr>
<tr>
<td colspan="4">Customer Address <INPUT TYPE="text" NAME="cust_address" SIZE="40"></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
<font size="+2">Site Survey</font><BR><BR>
Please Make sure the following is available where the equipment is to be installed.<BR>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td colspan="2">Are the proper Power requirements available <select NAME="power">
<?
// get proper power requirements
$query = "SELECT id, power from power";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $power) = mysql_fetch_row($result))
{
echo "<option value=$id>$power</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td>approx. distance to Power <INPUT TYPE="text" NAME="dist_power" MAXLENGTH=2 SIZE="2" value="0"> Ft.</td>
<td>Does Focal need to supply the Power Strip? (if the distance is over 5 Ft.)<select NAME="powerstrip">
<?
// do we need to get a powerstrip
$query = "SELECT id, powerstrip from powerstrip";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $powerstrip) = mysql_fetch_row($result))
{
echo "<option value=$id>$powerstrip</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td colspan="2">Method of mounting the Equipment <select NAME="eqptmount">
<?
// where is the equpt going to be mounted
$query = "SELECT id, equptmount from equptmount";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $equptmount) = mysql_fetch_row($result))
{
echo "<option value=$id>$equptmount</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td colspan="2">Proper Space (At least 3sq. Ft.)<select NAME="space">
<?
// is there enough space
$query = "SELECT id, space from space";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $space) = mysql_fetch_row($result))
{
echo "<option value=$id>$space</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td colspan="2"><font color="red"><b>Potential Concerns</B></font> where the equipment is going to be installed.</td>
</tr>
<tr>
<td colspan="2"><TEXTAREA NAME="concerns" ROWS="6" COLS="40">
</TEXTAREA></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
Please Verify the Dmarc Location<br>
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td>Is the Dmarc extended <select NAME="ilecextend">
<?
// did the Ilec Extend the cir
$query = "SELECT id, ilecextend from ilecextend";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $ilecextend) = mysql_fetch_row($result))
{
echo "<option value=$id>$ilecextend</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td>Do we have to extend the circuit. <select NAME="focalextend">
<?
// does focal have to extend the circuit
$query = "SELECT id, focalextend from focalextend";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
while (list($id, $focalextend) = mysql_fetch_row($result))
{
echo "<option value=$id>$focalextend</option>";
}
mysql_free_result($result);
?>
</select></td>
</tr>
<tr>
<td>Please give us any additional information: (I.E. Is the 66 Block far away from the location Of the IAD Equipment)</td>
</tr>
<tr>
<td><TEXTAREA NAME="addinfo" ROWS="6" COLS="40">
</TEXTAREA></td>
</tr>
</table>
<hr width="100%" size="2">
<br>
<br>
Site Survey Preformed by:<br>
<table width="50%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2">Tech Name <input type="text" name="tech_name" size="30"></td>
</tr>
<tr>
<td colspan="2">Tech Phone Number <INPUT TYPE="text" NAME="tech_phone" MAXLENGTH=12 SIZE="12" value="xxx-xxx-xxxx"></td>
</tr>
<tr>
<td>LEC Loop FOC date <input type=text size=10 name=lec_foc ></td>
<td>Focal FOC date <input type=text size=10 name=focal_foc ></td>
</tr>
<tr>
<td colspan="2">What City sold this Service <INPUT TYPE="text" NAME="city" size="30"></td>
</tr>
<tr>
<td colspan="2">Date Survey was Preformed on <input type=text size=10 name=date></td>
</tr>
</table>
<center>Thank you very much for completing this site survey.<BR>
<BR>
<INPUT TYPE="submit" value="Submit">
<INPUT TYPE="reset" value="Reset">
</center>
</form>
</td>
</tr>
</table>
<?
}
// form submitted, process it
else
{
// set up error list array
$errorList = array();
$count = 0;
// validate text input fields
if (empty($cir_id)) { $errorList[$count] = "Invalid entry: Circuit ID "; $count++; }
if (empty($cust_name)) { $errorList[$count] = "Invalid entry: Customer Name"; $count++; }
if (empty($cust_contact)) { $errorList[$count] = "Invalid entry: Customer Contact"; $count++; }
if (empty($cust_phone)) { $errorList[$count] = "Invalid entry: Customer Phone"; $count++; }
if (empty($cust_address)) { $errorList[$count] = "Invalid entry: Contact Address"; $count++; }
if (sizeof($errorList) == 0)
{
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
// insert data
$query = "INSERT INTO survey (id ,cir_id, cust_name, cust_contact, cust_phone, ext, f_altphone, altphnum, cust_address, f_power, dist_power, f_powerstrip, f_eqptmount, f_space, concerns, ilecextend, focalextend, addinfo, tech_name, tech_phone, lec_foc, focal_foc, city, survey_date
) VALUES ('$cir_id', '$cust_name', '$cust_contact', '$cust_phone', '$ext', '$altphone', '$phone', '$cust_address', '$power', '$dist_power', '$powerstrip', '$eqptmount', '$space', '$concerns', '$ilecextend', '$focalextend', '$addinfo', '$tech_name', '$tech_phone', '$lec_foc', '$focal_foc', '$city', '$date' )";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
// clean up
mysql_close($connection);
echo "Entry successfully added.<p><a href=$PHP_SELF>Add another entry</a>, or <a href=index.php>return to the main Page</a>";
}
else
{
listErrors();
}
}
?>
</body>
</html>
its not giving me theEntry successfully added thingy
it is also not writing to the database Any help Is great