On Tue, 2006-02-14 at 13:47 -0600, Michael Sullivan wrote:
> I am creating a web interface for registering entries for the annual Jr.
> High Music Festival at my college.  I am currently in the process of
> writing a page that will validate school registration information.  I
> have created a school registration page with forms and I am sending the
> data collected to a script called validate.php.  validate.php (much as
> the name suggests) checks the information submitted for validity and if
> it finds it so, will send it somewhere else for entry into a database.
> The problem is this:  I want to use pattern matching to make sure there
> are no undesirable characters in the phone number fields.  To facilitate
> this, I have set up three text boxes; one for area code, one for prefix,
> and one for the last four digits (I can't remember what that's called
> ATM.)  When validate.php is called, each of these values (as well as a
> few others) are incorporated as variables into the script.  The problem
> is that my pattern matching bit doesn't work.  I inserted a 'b' at the
> end of the area code; validate.php was supposed to spit out an error,
> but it didn't.  Here's the script:
> 
> <html>
> <body>
> <?
> $schoolname = $_POST['schoolname'];
> $directorname = $_POST['directorname'];
> 
> $parea = $_POST['parea'];
> $pprefix = $_POST['pprefix'];
> $prest = $_POST['prest'];
> 
> $farea = $_POST['farea'];
> $fprefix = $_POST['fprefix'];
> $frest = $_POST['frest'];
> $emailaddress = $_POST['emailaddress'];
> 
> if (preg_match("/D/", $parea, $array))
>    print "Error found in phone number area code information.  Possible
> typo?<br>\n";
> if (preg_match("/D/", $pprefix, $array))
>    print "Error found in phone number prefix information.  Possible
> typo?<br>\n";
> if (preg_match("/D/", $prest, $array))
>    print "Error found in the last four digits of phone number
> information.  Possible typo?<br>\n";
> 
> if (preg_match("/D/", $farea, $array))
>    print "Error found in fax number area code information.  Possible
> typo?<br>\n";
> 
> if (preg_match("/D/", $fprefix, $array))
>    print "Error found in fax number prefix information.  Possible
> typo?<br>\n";
> 
> if (preg_match("/D/", $frest, $array))
>    print "Error found in the last four digits of fax number area code
> information.  Possible typo?<br>\n";
> 
> ?>
> 
> <head>
> <link rel="stylesheet" href="standard.css" type="text/css">
> <title>2006 NEO Jr. High Music Festival - Validation</title>
> </head>
> 
> <?
> print "School Name:  $schoolname<br>\n";
> print "Director's Name:  $directorname<br>\n";
> print "Phone Number:  $parea-$pprefix-$prest<br>\n";
> print "Fax Number:  $farea-$fprefix-$frest<br>\n";
> print "Director's Email: $emailaddress<br><br><br>\n";
> include("registerschool.php");
> ?>
> </body>
> </html>
> 
> Can anyone help me with this?

Nevermind.  It was a stupid error on my part.  I forget to escape my
pattern...



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to