Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/10/2009, 20:34
Diegotopet
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Enviar datos de formulario despues de evaluar. PHP

Hola a todos, necesito ayuda.
Tengo un formulario en el que capturo ciertos datos para realizar el cobro en mi local.
Posteriormente al dar click al boton me evalua los campos para que no esten vacios y que los que tienen que ser numero sean validos.

La parte que no me sale es al momento de enviar el correo a mi cuenta con los datos para el cobro. Ya que tengo que enviar los datos a mi documento SEND.PHP.

Pero me sale este error:
Código HTML:
Warning: Cannot modify header information - headers already sent by (output started at /home/Form.php:8) in /home/Form.php on line 21
La linea 21 es esta
Código PHP:
header("Location: http://www.misitio.com/send.php"); 
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Adventure Weddings [Checkout]</title>
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
 <!--[if lte IE 6]>
      <link href="style-ie.css" media="screen" rel="stylesheet" type="text/css" />
    <![endif]-->
</head>
<body>
<? 
if($name=="" || $email=="" || $phone_number=="" || $card_type=="" || $card_number=="" || $card_holder_name=="" || $card_expiration_month=="" || $card_expiration_year=="" || $card_security_code=="" || $card_address=="" || $card_state=="" || $card_zip_code=="" || $card_country==""){
$requeridos="Fields in <strong>Bold</strong> are required";
}elseif(!
intval($phone_number)){
echo 
"<strong>Phone Number:</strong> Please enter your phone number below.";
}elseif(!
intval($card_number)){
echo 
"<strong>Credit Card Number:</strong> Please enter your phone number below.";
}elseif(!
intval($card_security_code)){
echo 
"<strong>Security Code:</strong> Please enter your phone number below.";
}else{
header("Location: http://www.misitio.com/send.php");
exit;
}
?>
<? 
if(isset($_POST['Submite'])){
 
$requeridos="<h4>Fields in <strong>Bold</strong> are required</h4>"
 }
?>
<div id="checkout">
    <p class="required-fields"><? echo $requeridos?></p>
    <form action="" method="post" name="reservation_Weddings" class="edit_reservation" id="reservation_Weddings">
    <div style="margin:0;padding:0"></div>
    <fieldset id="billing-information">
    <h3>Contact Information</h3>
        <div class="required field">
        <label for="name">Name<span><span>The reservation will be made in this name</span></span></label>
        <input class="text" id="name" name="name" size="30" type="text" />
    </div>
    <div class="required field">
        <label for="email">Email<span><span>A confirmation will be sent to this address</span></span></label>
        <input class="text" id="email" name="email" size="30" type="text" value="" />
    </div>
    <div class="required field">
        <label for="phone_number">Phone Number<span><span>The number we should call regarding this reservation</span></span></label>
        <input class="text" id="phone_number" name="phone_number" size="30" type="text" />
    </div>
        <div class="required field">
        <label for="Note">Comments:</label>
        <textarea class="text" id="comments" name="comments" cols="70%" rows="3"></textarea>
        </div>
        <h3>Billing Information</h3>
<div class="explanation">
<p><h4>Your information is safe and will be sent via secure server. These details are required to secure your event date. We will not be billing your credit card at this time.</h4></p>
</div>
      <table cellspacing="0">
      <tbody><tr>
      <th><label for="card_3">Pay with new card</label></th>
        <th><label for="cc_number">Credit Card Number</label></th>

        <th><label for="cc_name">Cardholder's Name</label></th>
        <th><label for="cc_expiration_month">Expiration Date</label></th>
        <th><label for="cc_security_code">Security Code</label></th>
      </tr>

      <tr>
        <td><select id="card_type" name="card_type">
<option value="">-----</option>
<option value="visa">Visa</option>
<option value="mastercard">Mastercard</option>
<option value="Amex">Amex</option></select>
        </td>
        <td>
          <input class="text" id="card_number" maxlength="17" name="card_number" size="17" type="text" />
        </td>
        <td>
          <input class="text" id="card_holder_name" name="card_holder_name" size="30" type="text" />

        </td>
        <td>
          <select id="card_expiration_month" name="card_expiration_month">
<option value="">--</option>
<option value="1">1</option>
</select>
          <select id="card_expiration_year" name="card_expiration_year">
<option value="">----</option>
<option value="2009">2009</option>
</select>

        </td>
        <td>
          <input class="text" id="card_security_code" name="card_security_code" size="4" type="text" />
        </td>
      </tr>
    </tbody></table>
    <div class="section">
      <div class="address" >
      <div class="edit">
        <div class="column">
          <div class="field">
            <label for="address">Address</label>
            <input class="test" id="card_address" name="card_address" size="30" type="text" />
          </div>
          <div class="field">
            <label for="state">City/State</label>

            <input class="text" id="card_state" name="card_state" size="30" type="text" />
          </div>
        </div>

        <div class="column">
          <div class="field">
            <label for="zip_code">Postal/Zip code</label>
            <input class="text" id="card_zip_code" name="card_zip_code" size="30" type="text" />
          </div>

          <div class="field">
            <label for="country">Country</label>
            <div class="select">
              <select id="card_country" name="card_country">
<option value="">Select One</option>
<option value="United States">United States</option>
<option value="Canada">Canada</option>
<option value="Mexico">Mexico</option>
</select>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</fieldset>
<div class="submit">  
  <input alt="Continue" id="Submite" src="continue.png" type="image" name="Submite" value="Enviar"/>
</div>
</form>
</div>
<div style="clear: both;"></div>
<br />
</body>
</html>
Este el documento send.php que es el que toma los datos del formulario y me los envia a mi cuenta de correo


Código PHP:
<?php
$name 
$_POST['name'];
$email $_POST['email'];
$phone_number $_POST['phone_number'];
$comments $_POST['comments'];
$card_type $_POST['card_type'];
$card_number $_POST['card_number'];
$card_holder_name $_POST['card_holder_name'];
$card_expiration_month $_POST['card_expiration_month'];
$card_expiration_year $_POST['card_expiration_year'];
$card_security_code $_POST['card_security_code'];
$card_address $_POST['card_address'];
$card_state $_POST['card_state'];
$card_zip_code $_POST['card_zip_code'];
$card_country $_POST['card_country'];

$header 'From: ' $email " \r\n";
$header .= "X-Mailer: PHP/" phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";

$mensaje "This message has been send by " $name ", from " $card_state ", " $card_country " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Comments:  " $comments " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Enviado el " date('d/m/Y'time());
$mensaje .= " \r\n";
$mensaje .= "Name:  " $name " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Email:  " $email " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Phone Number:  " $phone_number " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Type:  " $card_type " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Number:  " $card_number " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Holder Name:  " $card_holder_name " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Expiration Month:  " $card_expiration_month " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Expiration Year:  " $card_expiration_year " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Security Code:  " $card_security_code " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Address:  " $card_address " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card State:  " $card_state " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Zip Code:  " $card_zip_code " \r\n";
$mensaje .= " \r\n";
$mensaje .= "Card Country:  " $card_country " \r\n";

$para '[email protected]';
$asunto 'para cobrar';

mail($para$asuntoutf8_decode($mensaje), $header);

echo 
'Mensaje Enviado';
?>