No replies
Garfield
Offline
newbie
Last seen: 14 years 32 weeks ago
Joined: 2008-06-24
Posts: 3
Points: 0

On this page I use a scrolling div, this scrolling div works fine on my other pages.
The form on this page is oke, but I cannot see the buttons "verstuur and "annuleer".
When I click on "verplichte velden" and then give a tab I can see them fine, but then the first field "naam" disappears.

<?php
//Voorbereidingen voor het Tell-A-Friend Script
$msg_min_chars = "10";
$msg_max_chars = "250";
$errors = array();
//Einde voorbereidingen
include_once("includes/functions.php");
Head_TextAreaLength($_SERVER['PHP_SELF'], $msg_max_chars);
Outer_Start();
Site_Header("Tell A Friend");
?>
<div class="rightdiv3" id="contentouter">
<div id="contentinner">
<?php
   function validate_form_items()
   {
      global $msg_min_chars, $msg_max_chars;
      $msg_chars = "{".$msg_min_chars.",".$msg_max_chars."}";
      $form_items = array(
         "name"  => array(
            "regex" => "/^([a-zA-Z '-]+)$/",
            "error" => "Naam is in een ongeldig formaat"
         ),
         "email" => array(
            "regex" => "/^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$/",
            "error" => "E-mailadres is ongeldig"
         ),
         "message" => array(
            "regex" => "/.*/",
            "error" => "Bericht is te kort of langer dan $msg_max_chars tekens"
         )
      );
      global $errors;
      if(!preg_match($form_items["name"]["regex"], $_POST["your_name"]))
         $errors[] = $form_items["name"]["error"];
      if(!preg_match($form_items["email"]["regex"], $_POST["your_email"]))
         $errors[] = $form_items["email"]["error"];
      if(!preg_match($form_items["email"]["regex"], $_POST["friend_email1"]))
         $errors[] = "Vriend 1 ".$form_items["email"]["error"];
      if(strlen(trim($_POST["message"])) < $msg_min_chars || strlen(trim($_POST["message"])) >  $msg_max_chars )
         $errors[] = $form_items["message"]["error"];
      if(trim($_POST["friend_email2"]) != "")
      {
         if(!preg_match($form_items["email"]["regex"], $_POST["friend_email2"]))
            $errors[] = "Vriend 2 ".$form_items["email"]["error"];
      }
      if(trim($_POST["friend_email3"]) != "")
      {
         if(!preg_match($form_items["email"]["regex"], $_POST["friend_email3"]))
            $errors[] = "Vriend 3 ".$form_items["email"]["error"];
      }
      return count($errors);
   }
 
   function email($from, $from_name, $to, $message)
   {
      $headers .= "From: ".$from."\r\n";
      $headers .= "Content-type: text/plain; charset=ISO-8859-1";
      $your_domian_name = "www.oldfox.nl";
      //edit what you want your vistors to see in their email here
      $subject = $from_name." kijk eens naar deze site $your_domian_name";
      $your_message = "Hallo!\r\n";
      $your_message.= ucfirst($from_name);
      $your_message.= " kijk eens naar deze website $your_domian_name\r\n";
      $your_message.= "Bericht van ".ucfirst($from_name).":\n\r";
      $message=$your_message.stripslashes($message);
      if (mail($to,$subject,$message,$headers) )
      {
         return true;
      }
      else
      {
         return false;
      }
   }
 
   function print_error($errors)
   {
      foreach($errors as $error)
      {
         $err.=$error."<br/>";
      }
      echo
       "<font face=\"Arial\" size=\"2\" color=\"red\">$err</font><br />";
   }
 
   function form_process()
   {   
      $from_name = $_POST["your_name"];
      $from_email = $_POST["your_email"];
      $to = $_POST["your_email"].",".$_POST["friend_email1"].",".$_POST["friend_email2"].",".$_POST["friend_email3"];
      $message = $_POST["message"];
      $error_count = validate_form_items();
      if($error_count == 0)
      {
         if(email($from_email, $from_name, $to, $message))
         {
?>
<div class="mids">Dank u. Uw email is verzonden.</div>
<?php
            exit;
         }
         else
         {
            global $errors;
            $errors[] = "E-mail kon op dit moment niet worden verstuurd. <br>Neem contact op met de webmaster en vertel hem deze fout.";
         }
      }
   }
 
   if(isset($_POST["submit"]))
      form_process();
?>
Breng iemand anders op de hoogte van deze website.<br /><br />
<?php
global $errors;
if(count($errors) != 0)
{
   print_error($errors);
}
?>
<form method="post" action="tellafriend.php" class="mids">
<div class="formleft">Uw Naam *</div><div class="formright"><input type="text" name="your_name" id="name" size="31" maxlength="25" value="<?php echo $_POST["your_name"]?>" /></div>
<div class="formleft">Uw Email *</div><div class="formright"><input type="text" name="your_email" id="email" size="31" maxlength="80" value="<?php echo $_POST["your_email"]?>" /></div>
<div class="formleft">Email vriend *</div><div class="formright"><input type="text" name="friend_email1" id="friend_email1" size="31" maxlength="80" value="<?php echo $_POST["friend_email1"]?>" /></div>
<div class="formleft">Email vriend</div><div class="formright"><input type="text" name="friend_email2" id="friend_email2" size="31" maxlength="80" value="<?php echo $_POST["friend_email2"]?>" /></div>
<div class="formleft">Email vriend</div><div class="formright"><input type="text" name="friend_email3" id="friend_email3" size="31" maxlength="80" value="<?php echo $_POST["friend_email3"]?>" /></div>
<div class="formleft">Bericht *</div><div class="formright"><textarea name="message" id="message" cols="42" rows="5" onkeypress="check_length(this.form);" onkeydown="check_length(this.form);"><?php echo $_POST["message"]?></textarea></div>
<div class="formleft"> </div><div class="formright"><input size="1" value="<?php echo $msg_max_chars; ?>" name="text_num" readonly="readonly" /> Tekens over</div>
<div class="formleft"> </div><div class="formright">* Verplichte velden</div>
<div class="formleft"> </div><div class="formright"><input type="submit" value="Verstuur" name="submit" /> <input type="reset" value="Annuleer" /></div>
</form>
<br /><br />
</div>
</div>
<?php
ScrollingDivLayer();
Outer_End();
Foot();
?>

You can see it here:
http://www.oldfox.nl/Nieuwe%20Stijl/tellafriend.php

What I am doing not good?