I have the following two files used to insert data into a database. when
meinsert.php is executed a blank record is inserted in the database as if
the .php file is not receiving the variables.
Any ideas why this might be happening? Environment is stock RH9 with no
updates. I believe it is PHP 4.2.2 and Apache 2.0.40.
Thanks,
Mike
meinsert.html
<html>
<body>
<form action="meinser t.php" method="post">
Last Name: <input type="text" name="lastname" ><br>
His Name: <input type="text" name="hisname"> <br>
Her Name: <input type="text" name="hername"> <br>
Address: <input type="text" name="address"> <br>
City: <input type="text" name="city"><br >
State: <input type="text" name="state"><b r>
Zip: <input type="text" name="zip"><br>
Phone Number: <input type="text" name="phone"><b r>
Email: <input type="text" name="email"><b r>
Weekend Date: <input type="date" name="WkEndDate "><br>
Wedding Date: <input type="text" name="weddate"> <br>
Referred By: <input type="text" name="referred" ><br>
Prayer Couple: <input type="text" name="prayercou ple"><br>
Paid: <input type="text" name="paid"><br >
Area: <input type="text" name="area"><br >
<input type="submit" value="SUBMIT"> <br>
</form>
</body>
</html>
meinsert.php
<html>
<head>
<title>Insert Couple to Database</title>
</head>
<body>
<?php
//connect to database server
$dbcnx = @mysql_connect( "localhost" , "root", "password") ;
if (!dbcnx) {
echo( "<p>Unable to connect to the database server.<p>");
exit();
}
if (! @mysql_select_d b("ME") ){
echo ( "<p>Unable to locate the ME database.</p>" );
exit ();
}
echo ("Adding Couple");
//if ($submitcouple == "SUBMIT"){
echo ("getting here!<br>");
$sql = "INSERT INTO Couples SET
LastName = '$lastname',
HisName = '$hisname',
HerName = '$hername',
Address = '$address',
City = '$city',
State = '$state',
Zip = '$zip',
Phone = '$phone',
eMail = '$email',
WkEndDate = '$WkEndDate',
WeddingDate = '$weddate',
Referred = '$referred',
PrayerCouple = '$prayercouple' ,
Paid = '$paid',
Location = '$area'";
if (@mysql_query($ sql)){
echo ( "<p> " . $hisname . "and " . $hername . "have been added to the
database.</p>");
}else{
echo ("<p>Error adding couple to the database: " . mysql_error() .
"</p>");
}
//}
?>
</body>
</html>
meinsert.php is executed a blank record is inserted in the database as if
the .php file is not receiving the variables.
Any ideas why this might be happening? Environment is stock RH9 with no
updates. I believe it is PHP 4.2.2 and Apache 2.0.40.
Thanks,
Mike
meinsert.html
<html>
<body>
<form action="meinser t.php" method="post">
Last Name: <input type="text" name="lastname" ><br>
His Name: <input type="text" name="hisname"> <br>
Her Name: <input type="text" name="hername"> <br>
Address: <input type="text" name="address"> <br>
City: <input type="text" name="city"><br >
State: <input type="text" name="state"><b r>
Zip: <input type="text" name="zip"><br>
Phone Number: <input type="text" name="phone"><b r>
Email: <input type="text" name="email"><b r>
Weekend Date: <input type="date" name="WkEndDate "><br>
Wedding Date: <input type="text" name="weddate"> <br>
Referred By: <input type="text" name="referred" ><br>
Prayer Couple: <input type="text" name="prayercou ple"><br>
Paid: <input type="text" name="paid"><br >
Area: <input type="text" name="area"><br >
<input type="submit" value="SUBMIT"> <br>
</form>
</body>
</html>
meinsert.php
<html>
<head>
<title>Insert Couple to Database</title>
</head>
<body>
<?php
//connect to database server
$dbcnx = @mysql_connect( "localhost" , "root", "password") ;
if (!dbcnx) {
echo( "<p>Unable to connect to the database server.<p>");
exit();
}
if (! @mysql_select_d b("ME") ){
echo ( "<p>Unable to locate the ME database.</p>" );
exit ();
}
echo ("Adding Couple");
//if ($submitcouple == "SUBMIT"){
echo ("getting here!<br>");
$sql = "INSERT INTO Couples SET
LastName = '$lastname',
HisName = '$hisname',
HerName = '$hername',
Address = '$address',
City = '$city',
State = '$state',
Zip = '$zip',
Phone = '$phone',
eMail = '$email',
WkEndDate = '$WkEndDate',
WeddingDate = '$weddate',
Referred = '$referred',
PrayerCouple = '$prayercouple' ,
Paid = '$paid',
Location = '$area'";
if (@mysql_query($ sql)){
echo ( "<p> " . $hisname . "and " . $hername . "have been added to the
database.</p>");
}else{
echo ("<p>Error adding couple to the database: " . mysql_error() .
"</p>");
}
//}
?>
</body>
</html>
Comment