Join Login


Fotolia
 Help with database.
 by jkoss0687 - Feb 18, 2013

Ok so I'm new to php since I'm a designer not a programmer orginally. I am having issues with my code. When I press the submit button it shows the code and not the page and I cannot figure out why. I was hoping someone would be able to help me. This is my code. It is telling me that ".$row['lname']; is not working idk y. I started having issues when the error code "Dynamically-related files cannot not be discovered because there is no site definition for this document". What does that mean?

PLEASE HELP!

<?php
require("database.php");
$cfname=$_POST['cfname'];
$lname=$_POST['lname'];
//IF YOU SPOT ON DATABASE IS CALLED CFNAME

$sql="insert into Sanilac County (cfname) values ('$cfname')";
mysql_query($sql) or die(mysql_error());

$sql="insert into Sanilac County (lname) values ('$lname')";
mysql_query($sql) or die(mysql_error());

$sql="SELECT * FROM Sanilac County";
$query_result=mysql_query($sql) or die(mysql_error());
$row=mysql_fetch_array($query_result);

//display results

echo $row['cfname']. "<br />"



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sanilac County Parents as Teachers</title>

<style>
h1 {
color: #006;
font-family: Arial, Helvetica, sans-serif;
margin-top: 3em;

}
h2 {
word-spacing: 0.8em;
border: 3px solid rgb(201,201,255);
background-color: #0FF;
border-style: outset;
padding: 10px;
float: center;
margin-right: 16em;
margin-left: 16em;
margin-top: 3em;
margin-bottom: 3em;
}

h3 {font-size:48px;
font-weight:200;
color:#F60;
}
#date {
font-family: Arial, Helvetica, sans-serif;
font-size: 24px;
color:#F03;
word-spacing: .5em;
line-height: 2em;
}
</style>
</head>
<body style="background:url(Images/border2.gif) no-repeat fixed" >
<div style="
margin-right: 20em;
margin-left: 20em;">
<h1><big><center><a href="home.htm">Sanilac County Parents as Teachers</a></center></big></h1>
</div>

<div id="menu">
<h2><center>
<a href="Guardians.htm">Guardians</a>
<a href="Children.htm">Children</a>
<a href="Educators.htm">Educators</a>
<a href="#">Reports</a>
</center></h2></div>
<div style="border: 1px solid black; background: #FFF; margin-right: 21em; margin-left: 21em; padding-bottom: 10em;">
<?php echo 'Combined First Names: '.$cfname;?>
<?php echo 'Last Name:'.$lname;?>

</div>
</body>
</html>





jkoss0687
United States
Posts:1
Joined:Feb 18, 2013
  
Home About Contact Forum Youtube Privacy Policy
Copyright © 2009-2011 RiverCityGraphix.All Rights Reserved.