Form gönderildikten sonra, PHP betiğinin formun içeriğini e-postaya göndermesini istiyorum. Daha küçük bir forma bağlanan ve gayet iyi çalışan bir PHP betiğine sahibim. İki betik arasındaki tek fark, değişkenlerdir.PHP betiği form gönderdikten sonra e-posta göndermiyor
PHP Kod
<?php
if ($_POST["submit"]) {
$name=$_POST['name'];
$address=$_POST['address'];
$firstContactName=$_POST['firstContactName'];
$firstContactEmail=$_POST['firstContactEmail'];
$firstContactPhone=$_POST['firstContactPhone'];
$secondContactName=$_POST['secondContactName'];
$secondContactEmail=$_POST['secondContactEmail'];
$secondContactPhone=$_POST['secondContactPhone'];
$vehicleOrgName=$_POST['vehicleOrgName'];
$vehicle1=$_POST['vehicle1'];
$vehicle2=$_POST['vehicle2'];
$bus=$_POST['bus'];
$motorcycle=$_POST['motorcycle'];
$float=$_POST['float'];
$horse=$_POST['horse'];
$marchingunit=$_POST['marchingunit'];
$subject="Parade Application";
$body = "From: $name\n
<br /> Address: $address\n
<br /> First Contact Name: $firstContactName\n
<br /> First Contact Email: $firstContactEmail\n
<br /> First Contact Phone: $firstContactPhone\n
<br /> Second Contact Name: $secondContactName\n
<br /> Second Contact Email: $secondContactEmail\n
<br /> Second Contact Phone: $secondContactPhone\n
<br /> Entry Type: $vehicle1\t$vehicle2\t$bus\t$motorcycle\t$float\t$horse\t$marchingunit\n
<br /> Organization Name for Magnetic Sign: $vehicleOrgName\n";
/* Set e-mail recipient */
$ToEmail = '[email protected]';
$subject = trim($subject);
$mailheader = "From: [email protected]\r\n";
$mailheader .="MIME-Version: 1.0" . "\r\n" .
$mailheader .="Content-type: text/html; charset=UTF-8" . "\r\n";
mail(trim($ToEmail), $subject, $body, $mailheader) or die ('failure');
}
?>
Html Form Kodu
<form id="contactForm" name="contact" class="form-horizontal" role="form" method="post" action="">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name of Organization</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="name" name="name" value="" required>
</div>
</div>
<div class="form-group">
<label for="address" class="col-sm-2 control-label">Organization Address</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="address" name="address" value="" required>
</div>
</div>
<p class="center bold">1st Contact Person</p>
<div class="form-group">
<label for="firstContactName" class="col-sm-2 control-label">Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="firstContactName" name="firstContactName" value="" required>
</div>
</div>
<div class="form-group">
<label for="firstContactEmail" class="col-sm-2 control-label">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control" id="firstContactEmail" name="firstContactEmail" value="" required>
</div>
</div>
<div class="form-group">
<label for="firstContactPhone" class="col-sm-2 control-label">Telephone</label>
<div class="col-sm-8">
<input type="tel" class="form-control" id="firstContactPhone" name="firstContactPhone" value="" required>
</div>
</div>
<p class="center bold">2nd Contact Person</p>
<div class="form-group">
<label for="secondContactName" class="col-sm-2 control-label">Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="secondContactName" name="secondContactName" value="" required>
</div>
</div>
<div class="form-group">
<label for="secondContactEmail" class="col-sm-2 control-label">Email</label>
<div class="col-sm-8">
<input type="email" class="form-control" id="secondContactEmail" name="secondContactEmail" value="" required>
</div>
</div>
<div class="form-group">
<label for="secondContactPhone" class="col-sm-2 control-label">Telephone</label>
<div class="col-sm-8">
<input type="tel" class="form-control" id="secondContactPhone" name="secondContactPhone" value="" required>
</div>
</div>
<hr />
<p class="center bold">TYPE OF ENTRY</p>
<div class="form-group center">
<label class="checkbox-inline"><input type="checkbox" value="" id="vehicle1" name="vehicle1">Vehicle 1</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="vehicle2" name="vehicle2">Vehicle 2</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="bus" name="bus">Bus</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="motorcycle" name="motorcycle">Motorcycle</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="float" name="float">Float</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="horse"name="horse">Horse</label>
<label class="checkbox-inline"><input type="checkbox" value="" id="marchingunit" name="marchingunit">Marching Unit</label>
</div>
<div class="form-group center">
<p class="bold">ORGANIZATION NAME AS YOU WANT IT ON YOUR MAGNETIC SIGN IF REGISTERING A VEHICLE</p>
<div class="col-sm-8 col-sm-offset-2">
<input type="text" class="form-control" id="vehicleOrgName" name="vehicleOrgName" value="">
</div>
</div>
<div class="center">
<p class="center bold">APPLICATION FEE PER ENTRY</p>
<p>Vehicle - $100 (Includes 2 new signs)</p>
<p>Bus - $500</p>
<p>Motorcycle - $100</p>
<p>Motorcycle and Vehicle - $200</p>
<p>Float - $70 (Responsible for securing your own float)</p>
<p>Marching Unit - $35</p>
<p>Horse - $35</p>
<p>Marching Unit and Vehicle - $135</p>
<p style="color:#CE0001">ALL FEES ARE NON-REFUNDABLE</p>
<p style="color:#CE0001">DO NOT SEND CASH OR PERSONAL CHECKS</p>
</div>
<div class="center">
<p>If mailing, make money orders or cashiers checks payable:</p>
<p>Winston-Salem State University<br/>
C/O <strong>WSSU Homecoming Committee</strong><br />
601 MLK Dr.<br />
TSC-G05<br />
Winston-Salem, NC 27110
</p>
</div>
<h4 class="center" style="color:#CE0001">APPLICATION DEADLINE: Thursday, September 15</h4>
<hr />
<div>
<ol>
<li>All entries must move at a satisfactory rate of speed or be subject to removal from the parade line.</li>
<li>All audio must meet City Code.</li>
<li>No items can be thrown from vehicles.</li>
<li>Horses must be equipped with diaper buckets. There is a $100.00 refundable deposit required for horse units given as a separate check. This fee will not be refunded if the city has to clean horse waste from the parade route. The entry fee for horse groups ae the same as marching entries, $35.</li>
<li>All entries are required to attend 1 of 2 pre-parade meetings in person or by teleconferencing.</li>
<li>No trucks or trailers.</li>
</ol>
</div>
<hr />
<div class="center">
<h4>Float Contact Information</h4>
<p>Clines Floats<br />
Contact Person: Phyllis Caldwell<br />
336-830-2063</p>
<p>Southeastern Float Company<br />
Contact Person: Denver Wright<br />
803-917-0644</p>
<h4>For Additional Information Contact</h4>
<p>Stephen Powell<br />
Homecoming Parade Coordinator<br />
336-750-3386<br />
<a href="mailto:[email protected]">[email protected]</a></p>
</div>
<hr />
<div class="form-group center">
<div class="col-sm-8 col-sm-offset-2">
<button id="submit" name="submit" type="submit" class="btn btn-danger" data-toggle="modal" data-target="#myModal">Submit</button>
</div>
</div>
</form>
musunuz? –