FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Undefined index
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Undefined index [message #39876] Mon, 17 December 2007 07:42 Go to previous message
ghinwoon is currently offline  ghinwoon   Malaysia
Messages: 1
Registered: December 2007
Location: Malyasia
Karma:
Junior Member
Hi, i m new to php. I get an UNDEFINED INDEX error message that reads: Notice:Undefined index: topic in ....on line 12

Notice: Undefined index: detail in ....on line 13

Notice: Undefined index: name in ....on line 14

Notice: Undefined index: email in ... on line 15

Here is my code
<?php
$host="localhost";
$username="root";
$password="";
$db_name="test";
$tbl_name="forum_question";

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$datetime=date("d/m/y h:i:s");
$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic',

'$detail', '$name', '$email', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>


$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];is at line 12,13,14,15
can anyone tell me how to correct it, plz....
thanks!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: object not found on regular webpages
Next Topic: java script to php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 03 19:29:37 GMT 2024

Total time taken to generate the page: 0.05406 seconds