CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:



Jun 29, 2001, 9:20 AM

Post #1 of 3 (325 views)
If/else Can't Post

I am writing an if/else statement. I have a text field and i later set the inputed info equal to the scalar $link3. How can I put "If the value of $link3 = no value". Meaning that the visitor did not fill in that field? I have tried null and an empty set of quotes. The script ran, but it didn't do what i set in the IF statement. I am sorry for this description. Four straight days of looking at and writing code makes you less able to speak to humans =0) Thank you for whatever help you may be able to provide.

Enthusiast / Moderator

Jun 29, 2001, 9:40 AM

Post #2 of 3 (324 views)
Re: If/else [In reply to] Can't Post


I guess you're not only interested if the user typed nothing, but also if the user typed only whitespaces. Try this piece of code:

if( $link3 =~ /^\s*$/ ) { 
# user typed nothing or only whitespace

Hope this helps.

-- Marcus


Jun 29, 2001, 10:06 AM

Post #3 of 3 (323 views)
Re: If/else [In reply to] Can't Post

Thank you very much! This will help save a ton of space on the user interface of my script. Thanks! I am definitely going to put a link to these forums on my web desifgn site and if I or anyone I know has a question about cgi/perl...I am sending them here =0) Thanks a million!


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives