HELP please ..... Notice: Undefined index:

Alles, was PHP betrifft, kann hier besprochen werden.

HELP please ..... Notice: Undefined index:

Postby esteen » 17. February 2012 17:20

I new to xampp and also php ..... i facing this problems ...
I create a register member form with adobe flash, and wish to store the variable to the mysql via php .....
this is the coding for my php

<?php
// set your infomation.
$dbhost='localhost';
$dbusername='root';
$dbuserpass='';
$dbname='hotel';
// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
if (!mysql_select_db($dbname)) die(mysql_error());

$firstname= $_POST['firstname'];
$lastname = $_POST['lastname'];
$icnumber = $_POST['icnumber'];
$phonenumber = $_POST['phonenumber'];
$street = $_POST['street'];
$city = $_POST['city'];
$postcode = $_POST['postcode'];
$email = $_POST['email'];

$query = "INSERT INTO member(firstname, lastname, icnumber, phonenumber, street, city, postcode, email) VALUES('$firstname','$lastname','$icnumber','$phonenumber', '$street', '$city', '$postcode', '$email')";
mysql_query($query) or die(mysql_error());
echo "$user succussfully registered!";
?>

and then when I try to open my php file at local host with address http://localhost/regmem.php then it show me this error ...
Notice: Undefined index: firstname in C:\xampp\htdocs\FYP\regmem.php on line 11
Notice: Undefined index: lastname in C:\xampp\htdocs\FYP\regmem.php on line 12
Notice: Undefined index: icnumber in C:\xampp\htdocs\FYP\regmem.php on line 13
and order all variable error ......
after i check my mysql database with phpMyAdmin .... there is an empty data is saved to the table without any informations in it ...

HELP how to solve this?
esteen
 
Posts: 1
Joined: 17. February 2012 12:27
XAMPP Version: 5.6.3
Operating System: Windows 7

Re: HELP please ..... Notice: Undefined index:

Postby Altrea » 17. February 2012 19:46

Hi esteen,

whether or not you are new, you should take the time to:
  • choose the correct forum
  • choose a speaking topicname
  • don't produce double posts

esteen wrote:Notice: Undefined index: firstname in C:\xampp\htdocs\FYP\regmem.php on line 11
Notice: Undefined index: lastname in C:\xampp\htdocs\FYP\regmem.php on line 12
Notice: Undefined index: icnumber in C:\xampp\htdocs\FYP\regmem.php on line 13

You seem to have a problem with variable transfering from your form to your php script.
We don't know your form, so you are the only one who have all the information to solve the problem.

Maybe your form doesn't use the POST mode
Maybe your form does have different fieldnames

You can also try to debug with the Firefox Extension Firebug to see, what is sended and transfered.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6583
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64


Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests