if/else statements and stuff.
OK, I'm having trouble displaying the correct message. This is my statement:
if ($email=~/[^A-Za-z0-9-_\.\@]/) {
print "Ya screwed up buddy. It appears that you have some invalided characters in your address. Please <a href=javascript:history.back>repair<\/a> it.";
} else {
print "Your address has been accepted!";
}
if ($email=~/^([\w-]+[\w-.])*[\w-]+$/) {
print "Proper format is essential when entering an email address. Remember yourname\@yourdomain.com or whatever. Please <a href=javascript:history.back>repair<\/a> it.";
} else {
print "Your address has been accepted!!";
}
Now, let's say someone does enter the correct email format. They get two acceptence sentences. I don't want this. Or if they enter an improper format, they get an accept and a no accept. Any help?
[This message has been edited by Vorm (edited 17 May 2000).]
roBofh posted this at 10:22 — 17th May 2000.
They have: 122 posts
Joined: Jun 2000
Use elsif and combine the two if clauses.
If(blah){
do blah
} elsif (other-thing){
do other magic
} else {
final else
}
Orpheus posted this at 13:21 — 17th May 2000.
They have: 568 posts
Joined: Nov 1999
if ($email=~/[^A-Za-z0-9-_\.\@]/) {
print "Ya screwed up buddy. It appears that you have some invalided characters in your address. Please <a href=javascript:history.back>repair<\/a> it.";
} else {
print "Your address has been accepted!";
} elsif ($email=~/^([\w-]+[\w-.])*[\w-]+$/) {
print "Proper format is essential when entering an email address. Remember yourname\@yourdomain.com or whatever. Please <a href=javascript:history.back>repair<\/a> it.";
} else {
print "Your address has been accepted!!";
}
roBofh posted this at 00:11 — 18th May 2000.
They have: 122 posts
Joined: Jun 2000
No...more like
if ($email=~/[^A-Za-z0-9-_\.\@]/) {
print "Ya screwed up buddy. It appears that you have some invalided characters in your address. Please <a href=javascript:history.back>repair</a> it.";
} elsif ($email=~/^([\w-]+[\w-.])*[\w-]+$/) {
print "Proper format is essential when entering an email address. Remember yourname\@yourdomain.com or whatever. Please <a href=javascript:history.back>repair</a> it.";
} else {
print "Your address has been accepted!!";
}
Rob Radez
OSInvestor.com
Orpheus posted this at 00:33 — 18th May 2000.
They have: 568 posts
Joined: Nov 1999
my bad
roBofh posted this at 00:43 — 18th May 2000.
They have: 122 posts
Joined: Jun 2000
I know that feeling
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.