im completely new and im trying to setup a basic guestbook. i made my mysql table, my php code but it doesn't work. do i have to start up mysql or something special like that?
heres my code (bare with me its form a crude tutorial)
*sign.php*
<h2>Sign my Guest Book!!!</h2>
<form method=post action="create_entry.php">
<b>Name:</b>
<input type=text size=40 name=name>
<br>
<b>Location:</b>
<input type=text size=40 name=location>
<br>
<b>Email:</b>
<input type=text size=40 name=email>
<br>
<b>Home Page URL:</b>
<input type=text size=40 name=url>
<br>
<b>Comments:</b>
<textarea name=comments cols=40 rows=4 wrap=virtual></textarea>
<br>
<input type=submit name=submit value="Sign!">
<input type=reset name=reset value="Start Over">
</form>
*create_entry.php*
<?php
mysql_connect("localhost", "nobody","password" or
die ("Could not connect to database"
mysql_select_db("guestbook" or
die ("Could not select database"
if ($submit == "Sign!"
{
$query = "insert into guestbook
(name,location,email,url,comments) values
('$name', '$location', '$email', '$url', '$comments')"
;
mysql_query($query) or
die (mysql_error());
?>
<h2>Thanks!!!</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
include("sign.php"
}
?>
*view.php*
<?php include("dbconnect.php" ?>
<h2>View My Guest Book!!</h2>
<?php
$result = mysql_query("select * from guestbook" or
die (mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "<b>Name:</b>
echo $row["name"];
echo "<br>\n";
echo "<b>Location:</b>;
echo $row["location"];
echo "<br>\n";
echo "<b>Email:</b>;
echo $row["email"];
echo "<br>\n";
echo "<b>Url:</b>;
echo "$row["url"];
echo "<br>\n";
echo "<b>Comments:</b>";
echo $row[comments:];
echo "<br>\n";
echo "<br>\n";
echo "<br>\n";
}
mysql_free_result($result);
?>
<h2><a href="sign.php">Sign My Guest Book!!</a></h2>
help!
heres my code (bare with me its form a crude tutorial)
*sign.php*
<h2>Sign my Guest Book!!!</h2>
<form method=post action="create_entry.php">
<b>Name:</b>
<input type=text size=40 name=name>
<br>
<b>Location:</b>
<input type=text size=40 name=location>
<br>
<b>Email:</b>
<input type=text size=40 name=email>
<br>
<b>Home Page URL:</b>
<input type=text size=40 name=url>
<br>
<b>Comments:</b>
<textarea name=comments cols=40 rows=4 wrap=virtual></textarea>
<br>
<input type=submit name=submit value="Sign!">
<input type=reset name=reset value="Start Over">
</form>
*create_entry.php*
<?php
mysql_connect("localhost", "nobody","password" or
die ("Could not connect to database"
mysql_select_db("guestbook" or
die ("Could not select database"
if ($submit == "Sign!"
{
$query = "insert into guestbook
(name,location,email,url,comments) values
('$name', '$location', '$email', '$url', '$comments')"
;
mysql_query($query) or
die (mysql_error());
?>
<h2>Thanks!!!</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
include("sign.php"
}
?>
*view.php*
<?php include("dbconnect.php" ?>
<h2>View My Guest Book!!</h2>
<?php
$result = mysql_query("select * from guestbook" or
die (mysql_error());
while ($row = mysql_fetch_array($result))
{
echo "<b>Name:</b>
echo $row["name"];
echo "<br>\n";
echo "<b>Location:</b>;
echo $row["location"];
echo "<br>\n";
echo "<b>Email:</b>;
echo $row["email"];
echo "<br>\n";
echo "<b>Url:</b>;
echo "$row["url"];
echo "<br>\n";
echo "<b>Comments:</b>";
echo $row[comments:];
echo "<br>\n";
echo "<br>\n";
echo "<br>\n";
}
mysql_free_result($result);
?>
<h2><a href="sign.php">Sign My Guest Book!!</a></h2>
help!