Reply to Re: if/else statement, form-check

Your name:

Reply:


Posted by Ψrjan Langbakk on 06/29/06 23:33

Den 29.06.2006 20:47, skriblet David Haynes fΓΈlgende:
> Ørjan Langbakk wrote:
> [snip]
>> I might be dense, but it still isn't the problem. Of course I can check
>> if both are empty (invalid), that's easy.
>>
>> Why doesn't PHP have an if/then/else way of doing things... or, can I do
>> a check for criteria two _before_ the redirect?
>>
>> something like:
>> if (not valid)
>> then (check criteria two)
>> if both = invalid, then redirect
>> if both = valid, then -> check code
>> if code valiates, then send mail
>>
>>
> You seem to think this is a short-coming of the PHP language.
> Do you have this coded in another language? If so, can you share that?
>
> I profess that there has been so many messages back and forth about
> this, that I am no longer sure what you are asking for.
>
> Can you supply a set of input conditions (using email and phone) and
> what you expect the outcome to be? From you latest post, it sounds like
> you want to evaluate a quad-state logic condition with if-then-else
> logic in a single pass, but I am so confused at the moment, that would
> be a 'best guess' as to what you want.

Okay - I don't have access to the code right now, but I can try to
explain a little better.

I have a form, with several fields: name, address, email and phone.

When the user submits the form, I need him to have put down at least his
name and _either_ his email, address or phone number, so we have a sure
way to get in contact with him.

That's why, while validating the form-data, I would like to process
_first_ the name, and if there is no name entered, then I'll show an
error - if there _is_ a name entered, I go to the next part, which is to
check if there is an email-address entered - if there isn't, I want to
go to the _next_ part, check if there is a phonenumber entered, if there
isn't a phonenumber either, I want to show an errormessage - if there
_is_ a phonenumber entered, then that will be sufficient, and the final
check, for the valid numbers from a code-field will be checked - if
erroneus, I'll display an error, if correct, the form will be processed.

As of now, I have chosen to have name, email and phonenumber as
obligatory fields - they all get checked, and they all need input or the
error-page displays. That works, of course, but I would like to have the
above solution, as that would be more flexible towards the users.

--
mvh
Ørjan Langbakk
http://www.bergenpchjelp.no
http://www.cubic-design.net

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация