/    Sign up×
Community /Pin to ProfileBookmark

Notice: Undefined index:

i m new in php i make two pages first was first.php
the second was insert.php the codes are below but it show Notice: Undefined index:
how to remove this error
thanks

first page

<!DOCTYPE html>
<html>
<body>
<form id=”firstform” action=”insert.php” method=”post”>
<center> My First Page in PHP </center>
<center>Name:<input type=”text” id=”name” size=20>
FatherName: <input type=”text” id=”fname” size=20>
Address:<input type=”text” id=”add” size=20>
<input type=”submit” name=”sub”>
</form>
</body>
</html>

insert page

<html>
<body>
<?php

$con=mysqli_connect(“localhost”,”root”,”khan”,”first”);
// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}
$sql=”INSERT INTO bio(name, fathername , address)
VALUES
(‘$_POST[name]’,’$_POST[fname]’,’$_POST[add]’)”;

if (!mysqli_query($con,$sql))
{
die(‘Error: ‘ . mysqli_error($con));
}
echo “1 record added”;

mysqli_close($con);
?>
</body>
</html>

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@ismail_nasarauthorJun 16.2013 — some one reply how to make it
Copy linkTweet thisAlerts:
@Nicholas_DiazJun 17.2013 — change the name of first.php to index.php
Copy linkTweet thisAlerts:
@Nicholas_DiazJun 19.2013 — im a goof ball sorry i think this is what your looking for

http://en.kioskea.net/faq/3140-php-notice-undefined-index
×

Success!

Help @ismail_nasar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...