Jump to content

basic script


NickG21

Recommended Posts

hey everyone,
i have been writing scripts for only a couple weeks and am extremely new at this.  when my form action="example.php" am i supposed to only use the php code that i would have initially have put into my regular page?  i moved the php i had above my header of one page into a seperate .php page to post my info to and validate it and i am coming up with nothing.  below is my php code for a basic email validation.  any suggestions?

[code]<?php
function checkEmail($email)
{
  if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))
  {
      return FALSE;
  }
  list($Username, $Domain) = split("@",$email);
  if(getmxrr($Domain, $MXHost))
  {
      return TRUE;
  }
  else
  {
      if(@fsockopen($Domain, 25, $errno, $errstr, 15))
      {
        return TRUE;
      }
      else
      {
        return FALSE;
      }
  }
}
if (isset($_POST['submit'])) {
$company = $_POST['CompanyName'];
$name = $_POST['YourName'];
$email = $_POST['YourEmailAddress'];
$domainName = $_POST['ListOrDomainName'];


if(checkEmail($email) == FALSE)
{
  echo "E-mail entered is not valid.";
}
else
{
  echo "E-mail entered is valid.";
}
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/32049-basic-script/
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.