JeanieTallis Posted April 4, 2009 Share Posted April 4, 2009 /* Location error checking */ $field = "location"; //Use field name for location if(!$sublocation || strlen($sublocation = trim($sublocation)) == 0){ $form->setError($field, "* Location not selected"); } Whatever location I select, it always says the error field. Any one knows why? I don't want users to pick the default box. Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/ Share on other sites More sharing options...
Fruct0se Posted April 4, 2009 Share Posted April 4, 2009 Are you sure that $sublocation has a value? Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801125 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 To be honest, im not sure, I cant figure out how $location, changes to $sublocation the user and pass etc works though. I just can't figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801131 Share on other sites More sharing options...
Fruct0se Posted April 4, 2009 Share Posted April 4, 2009 Well there is nothing wrong with that code assuming $sublocation has a value. I would try and find out how it gets set. Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801133 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 It gets set like all the rest, especially in register. <form action="process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input name="user" type="text" value="<? echo $form->value("user"); ?>" size="38" maxlength="30"></td><td><? echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input name="pass" type="password" value="<? echo $form->value("pass"); ?>" size="38" maxlength="30"></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td>Email:</td><td><input name="email" type="text" value="<? echo $form->value("email"); ?>" size="38" maxlength="50"></td><td><? echo $form->error("email"); ?></td></tr> <tr><td>Location:</td> <td><select name="location" value"<? echo $form->value("location"); ?>"> <option value="Afghanistan" selected>Afghanistan</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="Andorra">Andorra</option> <option value="Anguila">Anguila</option> <option value="Antarctica">Antarctica</option> <option value="Antigua and Barbuda">Antigua and Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia ">Armenia </option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaidjan">Azerbaidjan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Bermuda">Bermuda</option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> <option value="Brazil">Brazil</option> <option value="Brunei">Brunei</option> <option value="Bulgaria">Bulgaria</option> <option value="Cambodia">Cambodia</option> <option value="Canada">Canada</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmans Islands">Christmans Islands</option> <option value="Cocos Island">Cocos Island</option> <option value="Colombia">Colombia</option> <option value="Cook Islands">Cook Islands</option> <option value="Costa Rica">Costa Rica</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="Ecuador">Ecuador</option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Estonia">Estonia</option> <option value="Falkland Islands">Falkland Islands</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="French Guyana">French Guyana</option> <option value="French Polynesia">French Polynesia</option> <option value="Gabon">Gabon</option> <option value="Germany">Germany</option> <option value="Gibraltar">Gibraltar</option> <option value="Georgia">Georgia</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe">Guadeloupe</option> <option value="Guatemala">Guatemala</option> <option value="Guinea-Bissau">Guinea-Bissau</option> <option value="Guinea">Guinea</option> <option value="Haiti">Haiti</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Ireland">Ireland</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati ">Kiribati </option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macedonia">Macedonia</option> <option value="Madagascar">Madagascar</option> <option value="Malawi">Malawi</option> <option value="Malaysia ">Malaysia </option> <option value="Maldives">Maldives</option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marocco">Marocco</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mexico">Mexico</option> <option value="Micronesia">Micronesia</option> <option value="Moldavia">Moldavia</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Myanmar">Myanmar</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherlands Antilles">Netherlands Antilles</option> <option value="Netherlands">Netherlands</option> <option value="New Zealand">New Zealand</option> <option value="Niue">Niue</option> <option value="North Korea">North Korea</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau">Palau</option> <option value="Panama">Panama</option> <option value="Papua New Guinea">Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru ">Peru </option> <option value="Philippines">Philippines</option> <option value="Poland">Poland</option> <option value="Portugal ">Portugal </option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Republic of Korea Reunion">Republic of Korea Reunion</option> <option value="Romania">Romania</option> <option value="Russia">Russia</option> <option value="Saint Helena">Saint Helena</option> <option value="Saint kitts and nevis">Saint kitts and nevis</option> <option value="Saint Lucia">Saint Lucia</option> <option value="Samoa">Samoa</option> <option value="San Marino">San Marino</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Seychelles">Seychelles</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia">Slovenia</option> <option value="Solomon Islands">Solomon Islands</option> <option value="South Africa">South Africa</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="St.Pierre and Miquelon">St.Pierre and Miquelon</option> <option value="St.Vincent and the Grenadines">St.Vincent and the Grenadines</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syria">Syria</option> <option value="Taiwan ">Taiwan </option> <option value="Tajikistan">Tajikistan</option> <option value="Thailand">Thailand</option> <option value="Trinidad and Tobago">Trinidad and Tobago</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Turks and Caicos Islands">Turks and Caicos Islands</option> <option value="Ukraine">Ukraine</option> <option value="UAE">UAE</option> <option value="UK">UK</option> <option value="USA">USA</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City">Vatican City</option> <option value="Vietnam">Vietnam</option> <option value="Virgin Islands (GB)">Virgin Islands (GB)</option> <option value="Virgin Islands (U.S.) ">Virgin Islands (U.S.) </option> <option value="Wallis and Futuna Islands">Wallis and Futuna Islands</option> <option value="Yemen">Yemen</option> <option value="Yugoslavia">Yugoslavia</option> </select><td><? echo $form->error("location"); ?></td> <tr><td colspan="2" align="right"> <input type="hidden" name="subjoin" value="1"> <input type="submit" value="Join!"></td></tr> <tr> <td colspan="2" align="left" class="style1 style4"><a href="http://www.myvee.co.uk">back </a></td> </tr> </table> </form> I'm guessing, well "<? echo $form->error("location"); ?>" thats the error part. I can do text boxes, I just can't do dropdown menu's. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801140 Share on other sites More sharing options...
Fruct0se Posted April 4, 2009 Share Posted April 4, 2009 I dont see sublocation in that form, can you post your process.php? Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801142 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 $subuser isn't in there either, its set somewhere. Do you want all of the process.php ? It's a big file or just register part. ($sub might be set anywhere in it so I don't know) Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801144 Share on other sites More sharing options...
Fruct0se Posted April 4, 2009 Share Posted April 4, 2009 You need to find how $sublocation gets its value, my assumption would be that process.php is setting it somehow, can you do a search for sublocation without the $ and see if it is found? Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801146 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 subpass sublocation subemail ain't found, subuser is, for the 'forgotten pass' Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801155 Share on other sites More sharing options...
Fruct0se Posted April 4, 2009 Share Posted April 4, 2009 If you hop on MSN I can try and help you out. Quote Link to comment https://forums.phpfreaks.com/topic/152530-solved-location-error-field-always-showing/#findComment-801159 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.