headache

Codes here !

Moderators: macek, egami, gesf

serene84
New php-forum User
New php-forum User
Posts: 5
Joined: Fri Oct 19, 2012 9:43 pm

headache

Postby serene84 » Fri Oct 19, 2012 9:48 pm

i encountered undefined index,but i'd checked,i don know anything wrong..i am so headache


$name = $_POST["fname"];
$propertytype = $_POST["fprop"];
$email = $_POST["femail"];
$title = $_POST["ftitle"];
$gender = $_POST["fgender"];
$numberofrooms = $_POST["fnoor"];
$contactnumber = $_POST["fconno"];
$numberofbathrooms = $_POST["fnoob"];
$askingprice = $_POST["fask"];

//echo $name;
//echo $propertytype;
//echo $email;
//echo $title;
//echo $gender;
//echo $numberofrooms;
//echo $contactnumber;
//echo $numberofbathrooms;
//echo $askingprice
Notice: Undefined index: fname in C:\xampp\htdocs\demo2.php on line 15

Notice: Undefined index: fprop in C:\xampp\htdocs\demo2.php on line 16

Notice: Undefined index: femail in C:\xampp\htdocs\demo2.php on line 17

Notice: Undefined index: ftitle in C:\xampp\htdocs\demo2.php on line 18

Notice: Undefined index: fgender in C:\xampp\htdocs\demo2.php on line 19

Notice: Undefined index: fnoor in C:\xampp\htdocs\demo2.php on line 20

Notice: Undefined index: fconno in C:\xampp\htdocs\demo2.php on line 21

Notice: Undefined index: fnoob in C:\xampp\htdocs\demo2.php on line 22

Notice: Undefined index: fask in C:\xampp\htdocs\demo2.php on line 23

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: headache

Postby johnj » Fri Oct 19, 2012 10:18 pm

Notice: Undefined index: fname in C:\xampp\htdocs\demo2.php on line 15


you have to open your demo2.php file and see if there is input by name 'fname' is present. Make sure this input is between <form></form> tags.

A better way to do this will be:

Code: Select all

$name = '';
if (isset($_POST["fname"]))
{
$name = $_POST["fname"];
}

serene84
New php-forum User
New php-forum User
Posts: 5
Joined: Fri Oct 19, 2012 9:43 pm

Re: headache

Postby serene84 » Fri Oct 19, 2012 11:58 pm

thankyou john,may all the bless with u


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests