Jump to content

Simple Question?


Trium918

Recommended Posts

Do you find anything wrong with the follow script? If so, how can I improve it?

 

<?php
//<-- VALIDATE FORM ENTRY -->
function valid_entry($form_vars) {
   foreach($form_vars as $entry)
   {
      if(empty($entry) || !ereg("^[a-zA-Z0-9]+$", $entry)) {
  	return false;
  }

   }
   return true;
}
?>

Check the form!

<?php
if(isset($submit)) {
// specific form variables to check
// $form_vars = array($name);

  if(!valid_entry($_POST)) {
   print "invalid data!"; 
  } else { 
   print "valid data";
  }
}
?>

Link to comment
https://forums.phpfreaks.com/topic/90491-simple-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.