<input type="submit" value="отправить">
</form>
</body>
</html>
No database selected
Вот сам код
index.php
<html>
<head>
<title>Форма</title>
<meta name="ключевые слова">
<meta content="форма отправки фио и номера телефона">
</head>
<body>
<form action="action.php" method="post">
<p><b>введите данные в форму</b></p>
<textarea rows="10" cols="45" name="text">
<input type="submit" value="отправить">
</form>
</body>
</html>
<?php
$result = mysql_query("SELECT*FROM msg")or die ( mysql_error() ) ; //or die ( mysql_error() )
$myrow = mysql_fetch_assoc(($result));
while($myrow = mysql_fetch_array($result)){
printf( $myrow["dat"],$myrow["tim"],$myrow["txt"]);
}
?>
db.php
<?
$linlk1 = mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_query("CREATE DATABASE IF NOT EXISTS db ");
mysql_select_db($link1);
mysql_query("CREATE TABLE IF NOT EXISTS `msg` (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`txt` TEXT, `dat` VARCHAR(255), `tim` VARCHAR(255))");
?>
action.php
<?
include("db.php");
if (isset($_POST['text'])){$text = $_POST['text']};
if ($text == ''){unset($text)}};
if (isset($text)){
$date = date("d.m.Y");
$time = time("H:i");
$result = mysql_query("INSERT INTO msg (txt,dat,tim) VALUES ($text,$date,$time) ");
}
?>