Hi all,

I am completely new with php and have been trying for over a month to add some simple form processing code to the website of a friend. I have tried different scripts and tried changing it several times. I have also previously had some help from people on this forum (and thank you very much I appreciate it) and nothing seems to work.

I am beginning to think that it must be the settings of the web hosting company but they say that it is the code and that they cant help with that as it is not their problem.

I am at my wits end and if anyone can help I would be eternally grateful.

Is anyone able to test to see if the code works as if they can I can contact the web hosting company and tell them it is a problem on their side.

Also is it best on the php script to start and finish it with the <head> and
<body> tags or does this make no difference?

When I load it to the web page and submit the info it always comes up with the message "No se ha realizado el envio de informaciones a $email" (which was originally "invalid email address but have had to change it as my friend is Spanish) and if I delete this bit of code, a blank screen pops up and the the info is not sent.

The php is:

Code:
<?php

/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */

$email = 'jan_colombini@hotmail.com';

$contactname = $HTTP_POST_VARS['contactname'];

$telephone = $HTTP_POST_VARS['telephone'];

$email = $HTTP_POST_VARS['email'];
$detalles = $HTTP_POST_VARS['detalles'];

$tipo = $HTTP_POST_VARS['tipo'];



if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {

  echo "<h4>Correo Invalido</h4>";

  echo "<a href='javascript:history.back(1);'>Back</a>";

} elseif ($subject == "") {

  echo "<h4>Sin Mensaje</h4>";

  echo "<a href='javascript:history.back(1);'>Back</a>";

}



/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */

elseif (mail($email, $contactname, $telephone, $email, $detalles, $tipo)) {

  echo "<h4>Su mensaje ha sido enviado</h4>";

} else {

  echo "<h4>No se ha realizado el envio de informaciones a $email</h4>";

}

?>
and my HTML is:

Code:
 <form action="form.php" method="post" class="contact">

        <fieldset>

         

          <div>

            <label for="contactname" class="fixedwidth">Nombre y Apellido</label>

            <input type="text" name="contactname" id="contactname"/>

          </div>

          <div>

            <label for="telephone" class="fixedwidth">Numero de Telefono</label>

            <input type="text" name="telephone" id="telephone"/>

          </div>

          <div>

            <label for="email" class="fixedwidth">Correo Electronico</label>

            <input type="text" name="email" id="email"/>

          </div>

          <div>  

              <label for="tipo" class="fixedwidth">Tipo de Seguro</label>

              <select name="tipo" id="tipo">     

                <option>Rodaje de spots</option>

                <option>Sesiones de Fotografía</option>

                <option>Cortometrajes</option>     

                <option>Otros suguros</option>  

              </select> 

            </div>

            <div>

              <p>Texto</p>

              <div class="textarea">

              <textarea name="detalles" id="details" cols="30" rows="7"></textarea>

              </div>

<div class="buttonarea">



  <input type="submit" value="Envianos la informacion"/>



</div>

            </div>

           <p>Una vez recibida su consulta nos pondremos en contacto con usted en la mayor brevedad</p>

        </fieldset>

      </form>
If anyone can help I really really would appreciate it.