hi m write a program to get the values from the form and storing them in database but its giving me error of undefined index for all variables . my code is

<?php

session_start();	
 
$con=mysql_connect("localhost","root","");
 
	mysql_select_db("pras2");



	
	$name=($_POST['name']);
	$type=($_POST['type']);
	$color=($_POST['color']);
	$unit_price=($_POST['price']);
	$size=($_POST['size']);
	$id=($_POST['id']);
	
	$query="INSERT INTO product (product_id, product_name, type, color, unit_price, size) VALUES ( '$id', '$name', '$type', '$color', '$unit_price', '$size')";
	$result=mysql_query($query);
	if ($result){
	echo " product has been added in database successfully";
	}
	else
	{
	echo "Your product cannot be added";
	}
	

?>
Member Avatar for diafol

How about answering your other open threads before posting any more new ones?

Lost patience finally. Bye.

answeredd all others

Why not search what Undefined Index means - there are very easy to understand explanations if you just Google it.

Why not search what Undefined Index means - there are very easy to understand explanations if you just Google it.

And a lot of threads on the same subject in this forum already.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.