You are here: if/else statement, form-check « PHP Programming Language « IT news, forums, messages
if/else statement, form-check

Posted by Ψrjan Langbakk on 12/17/99 11:51

I have a form where the user has the possibility to enclose his name.
email, address and phonenumber.

I want to be able to check if some of the fields are filled - at least
one. This is so that we have some way to contact the customer.

Today I check for the existence of an email-address, and a validation
code - what I need is a way to check, eg. whether email _or_ phone is
entered, and if none is entered, display an errorpage.

Today, my code looks like this:

if (empty( $_POST["mail_adresse"])) {
header( "Location: error_mail.php" );
}
elseif ($valkode != $sjekkode) {
header( "Location: error_kode.php" );
}
else {
mail("[lots of vaiables]", "From: $adrs" );
}

What I would like is some way to _always_ check for the correct code
being entered, but allow for either email, phonenumber or both being
present.

I've tried with || and && and other ways to check for more than one
variable in the if-statement, but I can't seem to get it right...

Any tips?

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

 

Navigation:

[Reply to this 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

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