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 06/20/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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация