[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Undefined Index

Asked by acicalla in PHP Scripting Language

Tags: undefined

Hello, I got a question about and undefined index.  I am trying to understand the error as this is the second time I have run across it while learning php from fixing this site.  The last time I just needed to add (!isset(before the $POST[])) althought that isn't working for the error this time.  So I really want to understand this error and how to fix / troubleshoot it.  Any help is greatly appreciated in advance.

line 14 - Undefined index:  UserName
line 14 begins with the if below
<?php
if($_POST['UserName']!="" && $_POST['Password1']!="" && $_POST['Password2']!="" && $_POST['Email']!="" && $_POST['Category'] !="" && $_POST['Name'] !="" && $_POST['Country'] !="" && $_POST['State'] !="" && $_POST['City'] !=""&& $_POST['ZipCode'] !="" && $_POST['Adress'] !=""  && $_POST['birth']!="" && $_POST['ss']!="" && $_POST['idnumber']!=""&& $_POST['phone']!="" && $_FILES['ImageFile']['tmp_name']!="" && $_FILES['ActImage']['tmp_name']!="" && $_FILES['RImage']['tmp_name']!=""){

      $errorMsg="";
      
      //real username
      $replacevalues = array('&','/'," ","?","+","%","$","#","@");
      $username=str_replace($replacevalues,"", $_POST['UserName']);
      
      //if username already exists
      $result = mysql_query("SELECT user FROM chatmodels WHERE user='$username'");
      if (mysql_num_rows($result)>=1){
            $errorMsg.="Username exists, please choose another one!<br>";
      }  else {
            //if dir still exists
            @rmdir("../../models/".$username."/");
            @mkdir("../../models/".$username."/");
                  
            //if password are correct
            if($_POST['Password1']!=$_POST['Password2']) {
                  $errorMsg.="Passwords do not match<br>";
            } else      if(strlen($_POST['Password1'])<6){
                  $errorMsg.="Passwords must be at least 6 characters long<br>";
            }

            //user ID
            $dateRegistered=time();
            $currentTime=date("YmdHis");
            $userId=md5("$currentTime".$_SERVER['REMOTE_ADDR']);

            //calculates some time
            $day=$_POST['day'];
            if ($day<10){$day="0".$day;}
            $currentSeconds=strtotime($day." ".$_POST['month']." ".$_POST['year']);

            //makes the users folder in models folder
            $urlThumbnail="../../models/".$_POST['UserName']."/thumbnail.jpg";
            $urlIdentityImage="../../models/".$_POST['UserName']."/".$userId.".jpg";
            $urlRImage="../../models/".$_POST['UserName']."/representative.jpg";

            //we copy the thumbail image
            if (!@copy($_FILES['ImageFile']['tmp_name'],$urlThumbnail)){
            $errorMsg.="Thumbnail image file could not be copied, please try again.<br>";
            }
            //we copy the id image
            if (!@copy($_FILES['ActImage']['tmp_name'],$urlIdentityImage)){
            $errorMsg.="ID image file could not be copied, please try again.<br>";
            }
            //we copy the R image
            if (!@copy($_FILES['RImage']['tmp_name'],$urlRImage)){
            $errorMsg.="Representative image file could not be copied, please try again.<br>";
            }
      }
            $db_pass=md5($_POST['Password1']);

            if ($errorMsg==""){
                  mysql_query("INSERT INTO `chatmodels` ( id , user , password , email , language1 , language2 ,language3,language4, birthDate , braSize , birthSign , weight , weightMeasure , height , heightMeasure , eyeColor , ethnicity , message , position , fantasies , hobby , hairColor , hairLength , pubicHair , tImage , cpm , epercentage ,minimum, category , name , country , state , city , zip , adress , actImage , pMethod , pInfo , dateRegistered , owner , lastLogIn , phone ,fax, idtype , idmonth , idyear , idnumber , birthplace , ssnumber , msn , yahoo , icq , broadcastplace, emailtype,  status , lastupdate) VALUES ('$userId','$_POST[UserName]' , '$db_pass', '$_POST[Email]', '$_POST[L1]', '$_POST[L2]', '$_POST[L3]', '$_POST[L4]', '$currentSeconds', '$_POST[BraSize]', '$_POST[BirthSign]', '$_POST[Weight]', '$_POST[weightMeasure]', '$_POST[Height]', '$_POST[heightMeasure]', '$_POST[eyeColor]', '$_POST[Ethnic]', '$_POST[Message]', '$_POST[Position]', '$_POST[Fantasies]', '$_POST[Hobbies]','$_POST[hairColor]','$_POST[hairLength]','$_POST[pubicHair]','Thumbnail Image', '295', '30','500','$_POST[Category]', '$_POST[Name]', '$_POST[Country]', '$_POST[State]','$_POST[City]', '$_POST[ZipCode]', '$_POST[Adress]', 'IdentityImage', '$_POST[PMethod]', '$_POST[PInfo]','$dateRegistered','$sopusername','$dateRegistered','$_POST[phone]','$_POST[fax]','$_POST[idtype]','$_POST[idmonth]','$_POST[idyear]','$_POST[idnumber]','$_POST[birth]','$_POST[ss]','$_POST[msn]','$_POST[yahoo]','$_POST[icq]','$_POST[location]','$_POST[emailtype]','pending','00')");
                  header ("Location: modelregistered.php");
            }
}
else
{
$errorMsg="Please fill all the required fields.";
}
?>
line 283 - Undefined index:  day
line 283 below begins with the if statement
<select name="day" id="day">
          <?
              for($i=01; $i<=31; $i++)
              {
              echo "<option value='$i'";
              if ($_POST['day']==$i){ echo "selected";}
              echo">$i</option>";
              }
              ?>
        </select>
line 289 - Undefined index:  month
line 290 - Undefined index:  month
line 291 - Undefined index:  month
line 292 - Undefined index:  month
line 293 - Undefined index:  month
line 294 - Undefined index:  month
line 295 - Undefined index:  month
line 296 - Undefined index:  month
line 297 - Undefined index:  month
line 289 starts again with the if statements below and follows consecutively.
     <select name="month" id="month">
            <option value="January" <? if ($_POST['month']=="January"){ echo "selected";} else if (!isset($_POST['month'])){ echo "selceted";}?>>January</option>
            <option value="February" <? if ($_POST['month']=="February"){ echo "selected";}?>>February</option>
            <option value="March" <? if ($_POST['month']=="March"){ echo "selected";}?>>June</option>
            <option value="July" <? if ($_POST['month']=="July"){ echo "selected";}?>>July</option>
            <option value="August" <? if ($_POST['month']=="August"){ echo "selected";}?>>August</option>
            <option value="September" <? if ($_POST['month']=="September"){ echo "selected";}?>>September</option>
            <option value="October" <? if ($_POST['month']=="October"){ echo "selected";}?>>October</option>
            <option value="November" <? if ($_POST['month']=="November"){ echo "selected";}?>>November</option>
            <option value="December" <? if ($_POST['month']=="December"){ echo "selected";}?>>December</option>
          </select>

line 304 - Undefined index:  year
line 304 begins with the if statement as well.  
<select name="year" id="year">
            <?
              for($i=1980; $i<=date('Y')-17; $i++)
              {
              echo "<option value='$i'";
               if ($_POST['year']==$i){ echo "selected";}
              echo ">$i</option>";
              }
             
              ?>
          </select>

[+][-]06/20/06 05:19 PM, ID: 16947635Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Tags: undefined
Sign Up Now!
Solution Provided By: Zyloch
Participating Experts: 1
Solution Grade: A
 
[+][-]06/20/06 05:48 PM, ID: 16947708Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 05:52 PM, ID: 16947713Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 07:53 PM, ID: 16948211Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 07:55 PM, ID: 16948219Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 08:37 PM, ID: 16948339Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:38 PM, ID: 16948343Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 08:44 PM, ID: 16948359Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:45 PM, ID: 16948362Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:46 PM, ID: 16948369Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 08:48 PM, ID: 16948373Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:49 PM, ID: 16948377Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:51 PM, ID: 16948387Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 08:55 PM, ID: 16948396Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 08:58 PM, ID: 16948404Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 09:05 PM, ID: 16948416Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 09:08 PM, ID: 16948426Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 09:08 PM, ID: 16948427Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 09:12 PM, ID: 16948437Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/20/06 09:28 PM, ID: 16948509Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 09:33 PM, ID: 16948521Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/20/06 09:55 PM, ID: 16948569Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89