Visa ett inlägg
Oläst 2006-01-05, 15:08 #13
anders.n anders.n är inte uppkopplad
Medlem
 
Reg.datum: Oct 2004
Inlägg: 113
anders.n anders.n är inte uppkopplad
Medlem
 
Reg.datum: Oct 2004
Inlägg: 113
Otestat...

Kod:
<?

  error_reporting(E_ALL);

  $message  = "";
  $emailclass = "basictext";
  $username  = "";

 

  if (isset($_POST['process'])) {

    $pattern = '/.*@.*\..*/';
    $email  = $_POST['email'];
    $urlname = urlencode($_POST['username']);

    if (preg_match($pattern, $_POST['email']) > 0) {
      // Here's where you would store
      // the data in a database...
      header(
       "location: thankyou.php?&username=$urlname");
      exit;
    }
    $message  = "Please enter a valid email address.";
    $username  = $_POST['name'];
    $emailclass = "errortext";
  }
?>

<html><title></title><head></head>
<style>
  .basictext {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px; color:#000066;
  }
  .errortext {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px; color:#C00000; font-weight: bold;
}
.errortext.input {background-color:#009933}
</style>
<body>
<form action="email.php" method="post">
  <? if ($message != "") {
    print '<span class="errortext">'.
      $message."<span><br>\n";
  }
  ?>
  <span class="<?print $emailclass; ?>">
    Email address:</span>
 <span class="<?print $emailclass; ?>"> <input name="email" type="text"
    class="<? print $emailclass; ?>"></span><br>
  


 <? if ($message != "") {
    print '<span class="errortext">'.
      $message."<span><br>\n";
  }
  ?>
  <span class="<?print $username; ?>">
    Namn:</span>
 <span class="<?print $username; ?>"> <input name="name" type="text"
    class="<? print $username; ?>"></span><br>
   <input type="hidden" name="process" value="1">
  <input type="submit" name="Button1" value="Sign up!">
</form>
</body></html>
anders.n är inte uppkopplad   Svara med citatSvara med citat