Jump to content
php.lv forumi

Undefined index


didy

Recommended Posts

<?php
require ($_SERVER["DOCUMENT_ROOT"]."/folder/config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die ("error connecting");
mysql_select_db($db_name, $connection);

$name = $_POST["txt_name"];
$len = strlen ($name);
//Only write to database if there's a name
if ($len > 0)
{
	$email = $_POST["txt_email"];
	$comment = $_POST["txt_comment"];
	$date = time();

	$query = "INSERT INTO guestbook (autoID, name, email, comment, date_auto) VALUES (NULL, '$name', '$email', '$comment', '$date')";
	mysql_query($query, $connection) or die (mysql_error());
}
?>

 

Problema: Notice: Undefined index: txt_name in E:\webroot\guestbook.php on line 5

($name = $_POST["txt_name"];)

 

kur kluda?

Edited by didy
Link to comment
Share on other sites

Foruma vieta varetu ielikt saiti uz php.net un google.lv un varbuut uz wiki! Tas pats vien butu! Vareji jau njemt vera kad teicu

"nevareju isti saprast ka parbaudiit ar isset vai empty"

Meginaju ka paradiits isset() - nekada rezultata! Tadel jau nacu uz forumu pec palidzibas! Bet paldies! Gan jau tiku gala!

Edited by didy
Link to comment
Share on other sites

×
×
  • Create New...