rendered paste body<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Equity Advantage Client Management</title>
<link href="../css/mycss_info.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
if (!empty($_POST)) {
echo '<pre>';
print_r($_POST);
echo '</pre>';
} else {
echo 'no post';
}
$dbc = mysql_connect("localhost","root","james") or die(mysql_error());
mysql_select_db("tea_accounts",$dbc) or die(mysql_error());
//add a client
$firstname = $_POST['Firstname'];
$initial = $_POST['Initial'];
$lastname = $_POST['Lastname'];
$address1 = $_POST['Address_Line_1'];
$address2 = $_POST['Address_Line_2'];
$city = $_POST['City'];
$state = $_POST['State'];
$zip = $_POST['Zipcode'];
$email_address = $_POST['Email_Address'];
$result = mysql_query("INSERT INTO client_info (firstname,middle_initial,lastname,address1,address2,city,state,zip,email_address) VALUES ('$firstname','$initial','$lastname','$address1','$address2','$city','$state','$zip','$email_address')") or die(mysql_error());
if (!$result){
echo'could not enter in the database';
}else{
echo'your entry was successful';
}
//Generate Form
$result = mysql_query("SELECT * FROM client_info WHERE id = '1'");
$row = mysql_fetch_array($result) or die(mysql_error());
echo '<pre>';
print_r($row);
echo '</pre>';
echo '<div id="form_wrapper">
<form id="form1" name="form1" method="post" action="index.php">
<div id="form">';
$data = array(
'Firstname' => 'firstname',
'Initial' => 'middle_initial',
'Lastname' => 'lastname',
'Address Line 1' => 'address1',
'Address Line 2' => 'address2',
'City' => 'city',
'State' => 'state',
'Zipcode' => 'zipcode',
'Email Address' => 'email_address'
);
foreach ($data as $name => $column) {
echo '<br /><label class="inputtext">'.$name.'</label> <input name="';
echo $name.'" value="'.((isset($row[$column]))?$row[$column]:'').'" type="text" class="inputbox" size="25" maxlength="45"/>';
}
echo '<div align="center">
<input type="submit" name="submit" class="submit" />
</div></form>';
?>
</div>
</body>
</html>