Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GCI validation

Posted on 1998-03-24
7
Medium Priority
?
194 Views
Last Modified: 2013-12-25
I am processing forms using CGI for Perl using UNIX ,
1. how can I validate a data entered in the form for a valid data?

2. How can I check if a selection has been made
e.g

Sex       :<select size="1" name"sex">
<option selected>Please select sex </option>
<option>Male </option>
<option>Female </option>
</select></p>

How can I check if an option is been selected when submitting the form ?

When the user enter the address
eg.

222 Highland Road
Westminster
WE12

How can I store the address in my text files as it appear
above and not in one single line ?
0
Comment
Question by:aswad012698
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1832195
You should first tell which language on what OS you are working with.

You should also note that most of the form validation can be done on the client side, with Javascript; this has the advantage of lowering a lot the server load, and the disadvantage that Javascript does not work reliably on different browser types and versions.
0
 

Author Comment

by:aswad012698
ID: 1832196
Edited text of question
0
 

Author Comment

by:aswad012698
ID: 1832197
Thanks Julio,

I am using CGI for Perl and the operating systems is UNIX.

0
Implementing Azure Infrastructure Exam 70-533

This course is designed to familiarize and instruct students in the content that is covered by Microsoft Exam 70-533, Implementing Microsoft Azure Solutions. It focuses on all the November 2016 objective domain topics.

 
LVL 1

Accepted Solution

by:
thufir earned 80 total points
ID: 1832198
let's start with how to put the address into multiple lines instead of one....
--------------------
to start with...FILENAME is the text file you're writing to...the other variables ($variable name) I'm using in this example are:
222 Highland Road --- $street
Westminster       --- $city
WE12              --- $zip_or_city_code
----------------------------------------------------------------
open(FILENAME)
print(FILENAME) "$first_address_variable\n"
print(FILENAME) "$city\n"
print(FILENAME) "$zip_or_city_code\n"
close(FILENAME)
-----------------------------------------------------------

Back to the first question, how to tell if a variable is used, there are two ways.  The way I usually use is to check if it's used, and show an error if it's not entered.  If you get confused let me know and I'll explain a bit more
-----
print "<ul>";
foreach $var (keys (%registration-data))
   {
   if (length($registration-data{"$var"})==0)
      {
      print "<li>Your <em> $var </em> will be used to help confirm your order. Please fill in the <em> $var </em> field";
      }
   }
print "</ul>"
0
 

Author Comment

by:aswad012698
ID: 1832199
Thanks thufir's for answering my question ..I have managed to sort out the address problem...but I am confused about checking if an option is selected :

Sex  :<select  name"sex">
    <option selected>Please select sex </option>
    <option>Male </option>
    <option>Female </option>
    </select></p>

how can check in the CGI if the user has selected one of the options ?

Many Thanks

0
 

Author Comment

by:aswad012698
ID: 1832200
Thanks thufir's for answering my question ..I have managed to sort out the address problem...but I am confused about checking if an option is selected :

Sex  :<select  name"sex">
    <option selected>Please select sex </option>
    <option>Male </option>
    <option>Female </option>
    </select></p>

how can check in the CGI if the user has selected one of the options ?

Many Thanks

0
 
LVL 1

Expert Comment

by:thufir
ID: 1832201
It's basically like this, I hope it helps...if not, let me know and I'll try again:

if (defined(sex))
  {
  whatever functions you need if selected
  }
else
  {
  whatever functions you need if not selected
  }
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question