Home > undefined index > notice undefined index gender in php error

Notice Undefined Index Gender In Php Error

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and undefined index error in php for radio button policies of this site About Us Learn more about Stack Overflow the php radio button company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined index in PHP in gender up vote 0 down vote favorite I'm very as in very new to PHP. There's this error: Notice: Undefined index: gender in C:\xampp\htdocs\exer1\exer1_process.php on line 6 By looking at it, I know it got to do something with the gender. I tried searching and looking for the error, but I just don't get it. Please help me. This is the code: Process.php First name is required.

"; } else { if (ctype_digit($fname)){ echo 'First name must be alphabet only!!

'; $fname=""; } } if (empty($mname)){ echo "Middle name is required.

"; } else { if (ctype_digit($mname)){ echo 'Middle name must be alphabet only!!

'; $mname=""; } } if (empty($lname)){ echo "Last name is required.

"; } else { if (ctype_digit($lname)){ echo 'Last name must be alphabet only!!

'; $lname=""; } } if (empty($age)){ echo "Age is required.

"; } else { if (!is_numeric($age)){ echo 'Age must only be numeric!!

'; $age='error'; } } if (empty($gender)){ echo "Gender is required.

"; } else { if ($gender=='female') { if ($status=='married') { $pre='Mrs.'; } else { $pre='Ms.'; } } } if ($status=="def"){ echo "

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million http://stackoverflow.com/questions/20162631/undefined-index-in-php-in-gender programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Input Type Radio Button Undefined Index up vote -1 down vote favorite $sel=""; $suc=""; $gend=""; $male=""; $female=""; $selected_radio=""; if(isset($_POST['save'])) { $e=0; $selected_radio = $_POST['gender']; if($selected_radio!="") { if ($selected_radio == 'male') { $male = 'checked'; } else if ($selected_radio == 'female') http://stackoverflow.com/questions/15895115/input-type-radio-button-undefined-index { $female = 'checked'; } } else { $sel="Select Your Gender"; $e=1; } if($e==0) { $suc="Success"; $male =""; $female =""; } } Without selecting option/radio button, when i click "save" (Submit button)., it showing "Undefined index: gender". But error msg also appearing "Select Your Gender". When i select any one option(Male/Female), its successfully appearing msg.("Success"). So Please help me to find the solution php button indexing undefined radio share|improve this question edited Apr 9 '13 at 7:11 Khaleel 95321129 asked Apr 9 '13 at 6:47 Sathya Velan 14 It simply means gender is not getting set when you select nothing. –Coder anonymous Apr 9 '13 at 6:49 If radio / checkbox is not selected its not sent as POST key.. even if your POST['save'] isset –Svetlio Apr 9 '13 at 6:50 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted $sel=""; $suc=""; $gend=""; $male=""; $female=""; $selected_radio=""; if(isset($_POST['save']) && isset($_POST['gender'])) { $e=0; $selected_radio = $_PO

Assembly Bitcoin Bug Reports C C# C++ https://thenewboston.com/forum/topic.php?id=2113 Dreamweaver Flash Game Design / UDK / Unity http://www.dreamincode.net/forums/topic/253465-undefined-index-error-in-php/ Gaming General Chat Google / YouTube Hardware HTML / CSS / Web Design Illustrator InDesign Introductions iOS Development / Swift Java / Android Development Javascript Linux Microsoft Networking Other Adobe Other Computer undefined index Related Other Programming Languages Perl Photoshop PHP Premiere Pro Python Ruby Shell Scripting SQL & Databases Suggestions Video Editing Visual Basic Forum Categories SQL & Databases I can't figure out the error here I can't figure out the error here notice undefined index 0 Kumi Festus · October 8, 2014 I tried to save html form data into mysql database. The info was actually saved in the database. Then why the error?I hope someone can figure out this for.


Message Receiving Page


Hello




Contact Us










Male
Female









$name = mysql_real_escape_string($_POST['FullName']);
$phone = mysql_real_escape_string($_POST['PhoneNumber']);
$gender = mysql_real_escape_string($_POST['Gender']);
$message = mysql_real_escape_string($_POST['Message']);
 mysql_connect('localhost','root','') or die(mysql_error());
 mysql_select_db('data1')or die(mysql_error());
 
 
 $insert = "INSERT INTO users1
(FullName,PhoneNumber,Gender,Message)
VALUES('$name','$phone','$gender','$message')";
 if(!mysql_query($insert)){
  die("Data could not be save".mysql_error());
   }else{
  echo "Data Saved To database";
  }
 

 

?>

The Error From The browserNotice: Undefined index: FullName in C:\xampp\htdocs\BMNetwork\message.php on line 25 Notice: Undefined index: PhoneNumber in C:\xampp\htdocs\BMNetwork\message.php on line 26 Noti

3 Replies - 3845 Views - Last Post: 30 October 2011 - 02:53 PM Rate Topic: #1 [emailprotected] New D.I.C Head Reputation: 0 Posts: 25 Joined: 02-September 11 Undefined index error in php Posted 30 October 2011 - 04:05 AM I use below code for search and view employee profile.But i got Variable undefine error... how can i fix it ? here i have posted errors.... Errors ------------ 1.Notice: Undefined index: uname in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 233 2.Notice: Undefined variable: image in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 300 3.Notice: Undefined variable: fname in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 335 4.Notice: Undefined variable: lname in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 336 5.Notice: Undefined variable: email in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 341 6.Notice: Undefined variable: address in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 346 7.Notice: Undefined variable: gender in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 355 8.Notice: Undefined variable: mobile in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 363 9.Notice: Undefined variable: land in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 369 10.Notice: Undefined variable: bod in C:\wamp\www\P2011-001\StaffHandling\emp_profile.php on line 376 FULL CODE HERE Employee Profile

 

© Copyright 2019|winbytes.org.