Hello i m creating my first guestbook in php and i m learning php+mysql from an ebbok.
I created the following and the following error occured
sign.php
<html>
<h2> Sign My Guestbook </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> 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>
The above page is completely correct.
create_entry.php
<?php
mysql_connect( 'localhost', 'yashtech_yashtech', 'password') or
die ("could not connect to database");
mysql_select_db('yashtech_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> Thank You Very Much </h2>
<h2> <a herf="view.php"> View My Guest Book </h2>
<?php
}
else
{
include("sign.php");
}
?>
The error which i get in the above php coding is
Could not select database
I ues Cpanel X and i think the version is 9.
Please help me. Looking forward for your help.