undefined variable in php while giving sql values
up vote
-3
down vote
favorite
while inserting values into table its showing error
the error is like this
Notice: Undefined variable: pname in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: price in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: tax in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: image in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: manufacturer in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: address in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: city in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: state in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: country in
/opt/lampp/htdocs/zubair/index.php on line 24 Duplicate entry '0' for
key 'PRIMARY
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
php sql
|
show 3 more comments
up vote
-3
down vote
favorite
while inserting values into table its showing error
the error is like this
Notice: Undefined variable: pname in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: price in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: tax in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: image in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: manufacturer in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: address in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: city in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: state in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: country in
/opt/lampp/htdocs/zubair/index.php on line 24 Duplicate entry '0' for
key 'PRIMARY
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
php sql
you are not passing any data in POST
– guradio
Nov 9 at 8:05
1
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11
|
show 3 more comments
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
while inserting values into table its showing error
the error is like this
Notice: Undefined variable: pname in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: price in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: tax in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: image in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: manufacturer in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: address in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: city in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: state in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: country in
/opt/lampp/htdocs/zubair/index.php on line 24 Duplicate entry '0' for
key 'PRIMARY
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
php sql
while inserting values into table its showing error
the error is like this
Notice: Undefined variable: pname in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: price in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: tax in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: image in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: manufacturer in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: address in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: city in /opt/lampp/htdocs/zubair/index.php
on line 24
Notice: Undefined variable: state in
/opt/lampp/htdocs/zubair/index.php on line 24
Notice: Undefined variable: country in
/opt/lampp/htdocs/zubair/index.php on line 24 Duplicate entry '0' for
key 'PRIMARY
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
<?
if(isset($_POST) & !empty($_POST)){
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
}
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
?>
php sql
php sql
edited Nov 9 at 8:26
Sfili_81
383314
383314
asked Nov 9 at 8:04
Zubair Nazer Oliyat
1
1
you are not passing any data in POST
– guradio
Nov 9 at 8:05
1
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11
|
show 3 more comments
you are not passing any data in POST
– guradio
Nov 9 at 8:05
1
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11
you are not passing any data in POST
– guradio
Nov 9 at 8:05
you are not passing any data in POST
– guradio
Nov 9 at 8:05
1
1
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11
|
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
0
down vote
According to your script variables defined if is set and not empty the $_POST variable. if you not pass your data to the script via POST method that section will not run. Then you get all the variables as undefined.
Probably your form method should change to POST. check your html form method if you using html form to test this.
add a comment |
up vote
0
down vote
You are using the & operator. Use &&
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
otherwise your $_POST variable is empty and be aware of mysql injection
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
According to your script variables defined if is set and not empty the $_POST variable. if you not pass your data to the script via POST method that section will not run. Then you get all the variables as undefined.
Probably your form method should change to POST. check your html form method if you using html form to test this.
add a comment |
up vote
0
down vote
According to your script variables defined if is set and not empty the $_POST variable. if you not pass your data to the script via POST method that section will not run. Then you get all the variables as undefined.
Probably your form method should change to POST. check your html form method if you using html form to test this.
add a comment |
up vote
0
down vote
up vote
0
down vote
According to your script variables defined if is set and not empty the $_POST variable. if you not pass your data to the script via POST method that section will not run. Then you get all the variables as undefined.
Probably your form method should change to POST. check your html form method if you using html form to test this.
According to your script variables defined if is set and not empty the $_POST variable. if you not pass your data to the script via POST method that section will not run. Then you get all the variables as undefined.
Probably your form method should change to POST. check your html form method if you using html form to test this.
answered Nov 9 at 8:13
Thushara Saman
1316
1316
add a comment |
add a comment |
up vote
0
down vote
You are using the & operator. Use &&
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
otherwise your $_POST variable is empty and be aware of mysql injection
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
add a comment |
up vote
0
down vote
You are using the & operator. Use &&
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
otherwise your $_POST variable is empty and be aware of mysql injection
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
add a comment |
up vote
0
down vote
up vote
0
down vote
You are using the & operator. Use &&
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
otherwise your $_POST variable is empty and be aware of mysql injection
You are using the & operator. Use &&
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
otherwise your $_POST variable is empty and be aware of mysql injection
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
<?
if(isset($_POST) && !empty($_POST)){ //<-- use the && operator
$pname = mysql_real_escape_string($_POST['pname']);
$price = mysql_real_escape_string($_POST['price']);
$tax = mysql_real_escape_string($_POST['tax']);
$image = mysql_real_escape_string($_POST['image']);
$manufacturer = $_POST['manufacturer'];
$address = mysql_real_escape_string($_POST['address']);
$city = mysql_real_escape_string($_POST['city']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$CreateSql = "INSERT INTO `products` (product_name, price, tax, image, manufacturer, address, city, state, country) VALUES ('$pname', '$price', '$tax', '$image', '$manufacturer', '$address', '$city', '$state', '$country')";
$connection = mysqli_connect("localhost","root","","product");
$res = mysqli_query($connection, $CreateSql) or die(mysqli_error($connection));
if($res){
$smsg = "Successfully inserted data, Insert New data.";
}else{
$fmsg = "Data not inserted, please try again later.";
}
}
?>
edited Nov 9 at 8:17
answered Nov 9 at 8:13
ivion
17325
17325
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
add a comment |
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
its not working
– Zubair Nazer Oliyat
Nov 9 at 8:16
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
have you check if you receive the value ?
– Sfili_81
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
What is the error?
– ivion
Nov 9 at 8:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221886%2fundefined-variable-in-php-while-giving-sql-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you are not passing any data in POST
– guradio
Nov 9 at 8:05
1
Possible duplicate of "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
– Tomasz
Nov 9 at 8:06
@guradio can u show me as an answer
– Zubair Nazer Oliyat
Nov 9 at 8:07
You have to set an else condition when you have empty fields. P.s. your code is open to SQL Injection
– Sfili_81
Nov 9 at 8:11
You are using & operator. Should be if(isset($_POST) && !empty($_POST)) otherwise $_POST is empty
– ivion
Nov 9 at 8:11