Re: One last try at this!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/17/07, Beauford <phpuser@xxxxxxxxxx> wrote:
I hope I can explain this so I can get this figured out, 'cause if not I may
just have to find an alternative to PHP. I can't be wasting 3 and 4 days on
something as simple as this.
This isn't a very nice intro into asking a question on a mailing list.
Nobody gets paid here to help you so you shouldn't demand it.  I
understand the desperation in being lost within a problem, but it
isn't anyones fault except your own.  I can assure you form validation
is a big part of my daily routine at my job and it is possible. :)


Below are 3 validation routines. When I first enter the page 'Optional' is
displayed for all of them as it should be, but when I click submit on the
form without entering any data, the first one displays optional (which it
should), but the 2nd and 3rd ones execute the elseif and the validation
routine says there are invalid characters in the string. If nothing is
entered in the form where is it getting a value???????????? It should never
get to the elseif to start with if nothing is entered in the form. So how
can I make a reliable check?

if(empty($orgname)) { $formerror['orgname'] = "Optional"; }
elseif($result = ValidateString($orgname, "2")) { $formerror['orgname'] =
$result; }

if(empty($website)) { $formerror['website'] = "Optional"; }
if($result = ValidateString($website, "2")) { $formerror['website'] =
$result; }

if(empty($event)) { $formerror['event'] = "Optional"; }
if($result = ValidateString($event, "2")) { $formerror['event'] = $result; }

Again, sorry to be a pain, but I just don't get it.

Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


I'm not sure where your variables are being set.  Are you relying on
register globals for $orgname?  Is $formerror being set with default
values?  What does ValidateString do?  If you don't want to paste your
code to this mailing list you can use http://pastebin.com/.  Perhaps
somebody smarter than me can figure it out, but I cannot until I see
more.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux