Hi, I am new in this forum and perl as well. I have a question. I have a form with 3 fields name, phone number and email address. now if any user put the wrong data in any one or more field, I just want to display a message where they made the mistake and the correct one should be the same as they entered. Example...
Name : John
Phone: 01452kao41 (this is the error)
email add: mail@email.com

when the user submit the form, the error message should appear and it will say where the error is, and I want that the name John and email add should not be changed as they are correct, so they user don't need to enter the same data again.

Can any one please help me?

Recommended Answers

All 11 Replies

see devshed for a reply to your question

Frankly, I would probably use Javascript for a solution to your problem; however, let me tell you what I have done in the past for your very issue. I used Mason a lot - which is sort of like a perl version of JSP or ASP. In Mason, you can parse web pages and embed perl code in the HTML with the:



tags. So, let's say you have a form that has three required fields, as you say. Mason would allow you to run checks on submit and, if one or more of these checks fails, you can do what Mason calls an "internal redirect" (which is like an include) in which you still have the STDIN (POST parameters) in memory and you could fill out the form with the correct entries and pass an "error message" back to the original form that appears on the screen next to or above the form. I do this in a login system with Mason, but I can't really show you the code, because it has encryption and a bunch of other internal access control checks (via "handlers" in Mason).

If you want to use CGI, you can do the same thing, but what you will have to do (or what I did in the past) is pass back the parameters to the original form on the URL line (like after a ? for query string), but you probably don't want to do it in clean text (like url.cgi?name=John&email=john@abc.com). Some people do that but I'm a CISSP and that gives me the willies. So, what I have done in the past is encode the query string (with a reason for failure) using something like base-64 encoding (or better a symmetric encryption algorithm plus base-64 encoding) and when you come back to the original page, you can unencode/decrypt the query string and have the parameters back in clean text to pre-fill the form.

Good luck!

Too bad the OP will never come back here to read the replies. They got their answer on a different forum back in December 2008 and have pretty much never returned here since then.

Really - well too bad for him/her/them. I hope that they have "replies on" and get notification. I wonder how many people here have used Mason? Have you Kevin? It's pretty dang cool - part scripting, part mod_perl.

BTW my name is Mike.

Oh, one more thing - I'm surprised how many newbies are here - is that expected?


Hi Mike,

I have used Mason but on a limited basis. I don't actually do much programming or web work these days. I keep from getting too rusty by answering questions on forums.

Most of the people that ask for help on forums are students or newbies.

You might want to check out www.perlmonks.com if you haven't already. The questions range from beginner to extremely advanced. I read that forum but I don't post on it as there are already a lot of very good perl people answering questions there and quite often the questions posted are too advanced for me to answer anyway. You might find it stimulating.

The perl forum on tek-tips.com used to be pretty busy but has tapered off, as well as perlguru.com. They get activity but not like they used to.

The Daniweb perl forum is erratic. The average is just a few questions a month, mostly newbies or beginners with pretty easy questions.


Well, hey, I don't have time (and nor do you i expect) to respond to posts - haha. I have looked at perlmonks and briefly at tek-tips but the reality is I'm busy (as I am sure you are). I rarely (since the pure newsgroups of the mid 90's) gotten much hel p from the internet. I have just been trying to help when someone helped me (aka daniweb system help). I could migrate to these other forums, but I don't have the time...

Thanks Kevin.


Cool. Actually I have plenty of time to read and post on forums. For me thats not a problem. I'm a semi-retired grandfather these days. In fact I have to go and pick up a grandson from school in about 30 minutes.

well hey good for you. I have 4 kids - 17, two 12 year old twins and a five year old. I don't really have time, but I'd love to share back. If I could help more I would. I am a CIO of 20 firms and I help them all I can, but I really am an (expert - I hate to say that because there are so many other better people_ of perl and woul dove to help newbies and others. I just want to give back but with the current economy (I'm in NYC) I do what I can.

Thanks for your help Kevin! I added to your reputation.

Take good care,


You too Mike, take care. Nice to "meet" you. I'm on the left coast in Southern California.

Cool for you. I lived in LA in 1985. Now I live in NYC. I try to help - those perl monks are probably beyond me - hehe. I said I am the CIO of 20 firms - that is a typo - I am the CIO of 200 firms. I do the best I can, but perl helps me everyday. I had a friend who once said - if you are a gunslinger at least you have a gun... and perl is my gun haha.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.