0

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";
	}
	

?>
4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by pritaeas
0

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

Lost patience finally. Bye.

0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.