hoogeebear
11-23-2007, 09:06 AM
Hi!
here are the two errors I get. Im trying to get the entries(name, email, comment) the user enter into my guestbook and store them in my database.
Here is my PHP code for doing this:
<?php
require ($_SERVER["DOCUMENT_ROOT"]. "/config/config_db.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die('Could not connect: ' . mysql_error());
mysql_select_db($db_name, $connection);
$name = $_POST["txt_name"];
$len - strlen($name);
//Only write to database if there is a name
if ($len > 0)
{
$email = $_POST["txt_email"];
$comment = $_POST["txt_comment"];
$query = "INSERT INTO guestbook (name, email, comment) VALUES ('$name', '$email', '$comment')";
mysql_query($query, $connection) or die(mysql_error());
}
?>
<html>
<head>
<title>Welcome to my GuestBook</title>
</head>
<body>
<center>
<form action="<?php echo $_Server[PHP_SELF]; ?>" method="POST">
<font face = "arial" size ="1">
Name: <input type="text" name = "txt_name">
Email: <input type="text" name = "txt_email"><br><br>
Comments:<br>
<textarea style = "width: 75%" rows = "10" name = "txt_comment"></textarea>
<center><input type ="submit" value="Submit"></center>
</font>
</form>
</center>
</body>
</html>
Here are the errors I get:
Warning: require(C:/Program Files/XAMP/xampp/htdocs/config/config_db.php) [function.require]: failed to open stream: No such file or directory in C:\Program Files\XAMP\xampp\htdocs\john\guestbook.php on line 2
Fatal error: require() [function.require]: Failed opening required 'C:/Program Files/XAMP/xampp/htdocs/config/config_db.php' (include_path='.;C:\Program Files\XAMP\xampp\php\pear\') in C:\Program Files\XAMP\xampp\htdocs\john\guestbook.php on line 2
Any help wouild be really appreciated.
here are the two errors I get. Im trying to get the entries(name, email, comment) the user enter into my guestbook and store them in my database.
Here is my PHP code for doing this:
<?php
require ($_SERVER["DOCUMENT_ROOT"]. "/config/config_db.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die('Could not connect: ' . mysql_error());
mysql_select_db($db_name, $connection);
$name = $_POST["txt_name"];
$len - strlen($name);
//Only write to database if there is a name
if ($len > 0)
{
$email = $_POST["txt_email"];
$comment = $_POST["txt_comment"];
$query = "INSERT INTO guestbook (name, email, comment) VALUES ('$name', '$email', '$comment')";
mysql_query($query, $connection) or die(mysql_error());
}
?>
<html>
<head>
<title>Welcome to my GuestBook</title>
</head>
<body>
<center>
<form action="<?php echo $_Server[PHP_SELF]; ?>" method="POST">
<font face = "arial" size ="1">
Name: <input type="text" name = "txt_name">
Email: <input type="text" name = "txt_email"><br><br>
Comments:<br>
<textarea style = "width: 75%" rows = "10" name = "txt_comment"></textarea>
<center><input type ="submit" value="Submit"></center>
</font>
</form>
</center>
</body>
</html>
Here are the errors I get:
Warning: require(C:/Program Files/XAMP/xampp/htdocs/config/config_db.php) [function.require]: failed to open stream: No such file or directory in C:\Program Files\XAMP\xampp\htdocs\john\guestbook.php on line 2
Fatal error: require() [function.require]: Failed opening required 'C:/Program Files/XAMP/xampp/htdocs/config/config_db.php' (include_path='.;C:\Program Files\XAMP\xampp\php\pear\') in C:\Program Files\XAMP\xampp\htdocs\john\guestbook.php on line 2
Any help wouild be really appreciated.