There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
bios black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers email error firefox firefox 3 game hard drive internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Undefined index


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,716 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
30-Jun-2008, 07:50 PM #16
Quote:
Originally Posted by Mudley View Post
unless the validation depends on previous inputs, there's not really any point in halting validation upon the first error
Sure there is. If he wants to highlight or provide specific context for the field with error, identifiying the fields individually makes sense. If you highlight ALL of the problem areas at the same time, the user can get confused and that's not good either.

Quote:
in fact, its a big UI 'piss off' factor to do so
Fact or opinion?

Peace...
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,716 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
30-Jun-2008, 07:56 PM #17
Quote:
Originally Posted by skyhigh007 View Post
Here's my function:
Code:
	function check_email ($email){
           if ($email==""){
            die("Please type in your E-maill address");
         }elseif(strpos($email, "@" )<2 ){
            die("Please type in a correct E-mail address");
          }elseif(strpos(substr($email,strpos($email,"@")), ".") < 2){
           die("Please type in a correct E-mail address");
         }elseif( strlen($email) <7 ){
          die("Please type in a correct E-mail address");
        }elseif(ubstr_count ($email,"@") !=1 ){
          die("Please type in a correct E-mail address");
        }else {

            echo "Thank you for signing up our newsletter";
       }
  }
The die function will terminate the checking once the error is found, so that it does not go on to the next checking. Die and exit terminates my include footer.php in the check.php page.
If the "check_email()" function is called by the main script, you don't need the call to "die()" and can simply return a return code to the main script. Then, the main script can do whatever is necessary, like call footer.php, to send the rest of the page to the browser for the user to see.

Peace...
Mudley's Avatar
Computer Specs
Senior Member with 100 posts.
 
Join Date: Apr 2008
Experience: Advanced
30-Jun-2008, 08:00 PM #18
Quote:
Originally Posted by tomdkat View Post
Sure there is. If he wants to highlight or provide specific context for the field with error, identifiying the fields individually makes sense. If you highlight ALL of the problem areas at the same time, the user can get confused and that's not good either.

Fact or opinion?

Peace...
the errors can still be identified individually. the code change for that is easy

fact, and common sense

picture this, you submit 10 pieces of data in a single form.
OOPS, the first piece of data isn't correct.
The form remembered all the rest of your input though - phew.
You fix the first piece, but OOPS, the 2nd input isn't formatted properly either. Apparently the developer wants dashes in the phone number field
No prob, the form remembered my data. Add the dashes, submit again.
OOOPS I forgot to select something on this select box Submit again.
OOOOOOPS phone number gets dashes, but the social security number doesn't.

Wouldn't it be awesome if i knew ALL the errors before submitting the form 5 times?
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,716 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
30-Jun-2008, 09:08 PM #19
Quote:
Originally Posted by Mudley View Post
Wouldn't it be awesome if i knew ALL the errors before submitting the form 5 times?
Sure it would, BUT given the fact the user didn't supply the required information, in the first place, that means:
  1. The user didn't know which fields were required or the proper format for the information to be supplied in the fields. (shame on page designer)
  2. The user didn't care enough to fill in the form with the proper data or tried to put "bogus" data in just to get the form submitted. (shame on the user)
Given the fact we're NOT doing client-side validation (which would be perfect for this kind of thing), all the "back and forth" can be frustrating. On the flip side, being presented a page with a perceived "tons" of errors displayed can either confuse or dishearten the user so they give up on the form and go elsewhere.

As for the issue of alerting the user of ALL errors at once being a "good UI design" in fact, where is the data backing this up? Or is this simply your opinion you're trying to position as being fact?

As for this being a "common sense" issue, "common sense" would also dictate eliminating unnecessary server traffic, but that's a separate issue.

In the end, it will be up to the form designer to determine which method of alerting the user of which form fields has problems is the best for the form being designed.

Peace...
skyhigh007's Avatar
Senior Member with 393 posts.
 
Join Date: Jun 2004
01-Jul-2008, 12:41 AM #20
So the way I check for the validation of the E-mail is not efficient or is nota good way to check ?

The check_email() was called in the body section of check.php page and thats the only php code in the check.php with the exception of include footer.php at the bottom of the page.

Code:
<?php
	      if(isset($_POST['email'])){
	       $email=mysql_real_escape_string($_POST["email"]);
           echo "<center>$email</center>";
           $shop->db->check_email($email);
            }else{
	    echo "Please type in your E-mail address";
	}
?>
I don't know if return will work on this, but i will try
skyhigh007's Avatar
Senior Member with 393 posts.
 
Join Date: Jun 2004
01-Jul-2008, 02:44 PM #21
Great, the return statement worked.
skyhigh007's Avatar
Senior Member with 393 posts.
 
Join Date: Jun 2004
01-Jul-2008, 03:22 PM #22
Even thought the return method worked and the messages gets printed, but then everything gets stored into the database. So, I guess I will have to use die or exit .
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,716 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
03-Jul-2008, 05:38 PM #23
Quote:
Originally Posted by skyhigh007 View Post
Even thought the return method worked and the messages gets printed, but then everything gets stored into the database. So, I guess I will have to use die or exit .
Or, you will need to adjust the structure of your script to better accommodate return values from functions.

I'm thinking you script would function something like this (pseudo-code below):

Get form data

$validForm = validateForm();
if ($validForm == "false") {
// output any necessary error related info
} else {
// do any proper processing of form data, including storing in database
}

Send the footer info to the browser
End the script

*******************************

And then validateForm() would look like this:

function validateForm() {
$validForm = "true";
if (isset($_POST['email'])) {
$validEntry = $shop->db->check_email($_POST['email']);
if ($validEntry != "true")
$validForm = "false";
}
// and something similar for the other fields

return $validForm;
}

function check_email($email) {
$validField = "true";
$email=mysql_real_escape_string($email);
echo "<center>$email</center>";

// Do e-mail address check here
if (not valid e-mail address) {
echo "Please type in a valid e-mail address";
$validField = "false";
}

return $validField;
}

And so on.

Peace...
skyhigh007's Avatar
Senior Member with 393 posts.
 
Join Date: Jun 2004
06-Jul-2008, 01:12 PM #24
Yea, I solved the problem in a similar way that you've posted. Thanks
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:23 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.