PHP Variable in HTML mail by PHP - php

I can't find any solution for my problem. And the things I found don't work. I want to put the variables from a form into an HTML mail. I think I understand the way to get POST variables from a form into an HTML mail, but it doesn't work. This is my PHP script which is in a separate data.php:
mailerneu.php
<?php
error_reporting(E_ALL);
$vorname = $_POST["Vorname"];
$nachname = $_POST["Nachname"];
$email = $_POST["Mailadresse"];
$telefonnumer = $_POST["Telefonnummer"];
$geburtsjahr = $_POST["Geburtsjahr"];
$plz = $_POST["PLZ"];
$datum = $_POST["Datum"];
$zeit = $_POST["Zeit"];
$personen = $_POST["Personen"];
$bereich = $_POST["Bereich"];
$nachricht = $_POST["Nachricht"];
$mailTo = "fixl#bodega-online.de";
$subject = "Tischreservierung";
$from = "From: Bodega Bremerhaven<reservierungen#domain.de>\r\n";
$from .= "Content-Type: text/html; charset; utf8\r\n";
$text = "
<head>
<title>Neue Tischreservierung von <strong>$vorname $nachname</strong></title>
</head>
<body>
<table style='font-family:calibri,sans-serif; font-size: 16pt;'>
<tr>
<td>Vorname:</td>
<td>".htmlspecialchars($vorname)."</td>
</tr>
<tr>
<td>Nachname:</td>
<td>" .$nachname. "</td>
</tr>
<tr>
<td>Email:</td>
<td>" .$email. "</td>
</tr>
<tr>
<td>Telefonnummer:</td>
<td>" .$telefonnummer. "</td>
</tr>
<tr>
<td>Geburtsjahr:</td>
<td>" .$geburtsjahr. "</td>
</tr>
<tr>
<td>PLZ:</td>
<td>" .$plz. "</td>
</tr>
<tr>
<td>Datum:</td>
<td>" .$datum. "</td>
</tr>
<tr>
<td>Uhrzeit:</td>
<td>" .$zeit. "</td>
</tr>
<tr>
<td>Personen:</td>
<td>" .$personen. "</td>
</tr>
<tr>
<td>Bereich:</td>
<td>" .$bereich. "</td>
</tr>
<tr>
<td>Nachricht:</td>
<td>" .$nachricht. "</td>
</tr>
</body>";
mail($mailTo, $subject, $text, $from);
?>
This is the PHP file with my HTML form:
reservierung.php
<?php
include ("mailerneu.php");
?>
<div class="text">
<form method="post" action="reservtrue.php">
<table id="reservtable">
<tr>
<td>
<label for="vornamelbl"><strong id="textreserv">Vorname:</strong></label>
</td>
<td>
<input type="text" name="Vorname" placeholder="Vorname" class="formreserv" id="vornamelbl">
</td>
</tr>
<tr>
<td>
<label for="nachnamelbl"><strong id="textreserv">Nachname:</strong></label>
</td>
<td>
<input type="text" name="Nachname" placeholder="Nachname" class="formreserv" id="nachnamelbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="emaillbl"><strong id="textreserv">e-Mail Adresse:</strong></label>
</td>
<td>
<input type="email" name="Mailadresse" placeholder="Gültige Adresse!" class="formreserv" id="emaillbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="telefonnummerlbl"><strong id="textreserv">Telefonnummer:</strong></label>
</td>
<td>
<input type="tel" name="Telefonnummer" placeholder="Mobil oder Festnetz" min="5" max="20" class="formreserv" id="telefonnummerlbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="geburtsjahrlbl"><strong id="textreserv">Geburtsjahr:</strong></label>
</td>
<td>
<input type="text" name="Geburtsjahr" placeholder="1984" min="4" max="4" class="formreserv" id="geburtsjahrlbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="postleitzahllbl"><strong id="textreserv">Postleitzahl</strong></label>
</td>
<td>
<input type="text" name="PLZ" placeholder="PLZ" min="5" max="5" class="formreserv" id="postleitzahllbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="datumlbl"><strong id="textreserv">Datum der Reservierung:</strong></label>
</td>
<td>
<input type="date" name="Datum" placeholder="Klick" min="10" max="10" class="formreserv" id="datumlbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="uhrzeitlbl"><strong id="textreserv">Uhrzeit:</strong></label>
</td>
<td>
<input type="text" name="Zeit" placeholder="Stunde" min="12" max="21" class="formreservhour" id="uhrzeitlbl" required>
<input type="text" name=" " placeholder="Minute" min="00" max="59" class="formreservminute" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="personenlbl"><strong id="textreserv">Personen:</strong></label>
</td>
<td>
<input type="text" name="Personen" placeholder="1 bis 30" min="1" max="2" class="formreserv" id="personenlbl" required><strong id="required"> *</strong>
</td>
</tr>
<tr>
<td>
<label for="bereichlbl"><strong id="textreserv">Bitte Bereich wählen:</strong></label>
</td>
<td>
<form>
<select name="Bereich" class="dropreserv" id="bereichlbl">
<option>Bereich wählen:</option>
<option>Nichtraucher</option>
<option id="raucher">Raucher</option>
</select><strong id="required"> *</strong>
</form>
</td>
</tr>
<tr>
<td>
<label for="nachrichtlbl"><strong id="textreserv">Nachricht (optional):</strong></label>
</td>
<td>
<textarea name="Nachricht:" class="reservtextarea" id="nachrichtlbl" placeholder="Ihr Text"></textarea>
</td>
</tr>
<tr>
<td>
<label for="click"><strong id="textreserv">Eine Kopie an mich</strong></label>
</td>
<td>
<div class="checkbox">
<input type="checkbox" name="sendcopy" value="copy" id="click">
</div>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="" value="Reservieren" id="submit">
</td>
</tr>
</table>
</form>
</div>
I hope I didn't do lots of mistakes. I get the HTML table in mail. But only the variables are empty in <td>. Hopefully waiting and still researching.

Every time the PHP mailerneu.php file is included, it triggers a mail with empty data as the form has not been submitted yet. So better use the include this way:
if (isset($_POST['Vorname']) {
include ("mailerneu.php");
}
Also, I found a mistake in your HTML form:
name="Nachricht:" - you have added an extra : (double dots). Please verify your HTML form inputs name once.

Related

Making file attachment optional instead of compulsory

I am new to php. I have created a form with various fields and a file attachment. After doing so many searches on google, I finally got the php script to send email with attachments. This script uses phpmailer to send form data as well as attachment. Everything is working fine. I am getting the form data as well as attachments in email. My problem is that the attachment is compulsory. If the user does not attach file, it gives an error and the form is not submitted. I want to have the attachment as optional means even if the user does not upload the files, I should get the rest of the form in email and if the user uploads the files, I should get the attachments too. In my html form file attachment is not a required field. Can somebody help me in this? All the thanks in advance. My php script is as follows:
<?php
/**
* Simple example script using PHPMailer with exceptions enabled
* #package phpmailer
* #version $Id$
*/
require 'class.phpmailer.php';
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$to = "saxena#designmaniac.in";
$mail->AddAddress($to);
$mail->From = $_POST['email'];
$mail->FromName = $_POST['name_f'];
$mail->Subject = "Admission Form";
$body = "<table>
<tr>
<th colspan='2'>Admission Form</th>
</tr>
<tr>
<td style='font-weight:bold'>Course :</td>
<td>".$_POST['course']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Payment Mode :</td>
<td>".$_POST['p_mode']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Payment options :</td>
<td>".$_POST['p_option']."</td>
</tr>
<tr>
<td style='font-weight:bold'>First Name :</td>
<td>".$_POST['name_f']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Middle Name : </td>
<td>".$_POST['name_m']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Last Name : </td>
<td>".$_POST['name_l']."</td>
</tr>
<tr>
<td style='font-weight:bold'>E-mail : </td>
<td>".$_POST['email']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Date of Birth : </td>
<td>".$_POST['date']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Gender : </td>
<td>".$_POST['gender']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Nationality : </td>
<td>".$_POST['nationality']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Address : </td>
<td>".$_POST['address_line1']."</td>
</tr>
<tr>
<td style='font-weight:bold'>City : </td>
<td>".$_POST['city']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Zip Code : </td>
<td>".$_POST['zip']."</td>
</tr>
<tr>
<td style='font-weight:bold'>State : </td>
<td>".$_POST['state']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Country : </td>
<td>".$_POST['country']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Mobile Number : </td>
<td>".$_POST['mobile_number']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Father/Mother First Name : </td>
<td>".$_POST['fname_f']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Father/Mother Middle Name : </td>
<td>".$_POST['fname_m']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Father/Mother Last Name : </td>
<td>".$_POST['fname_l']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Father/Mother Mobile No : </td>
<td>".$_POST['mobile_number1']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Qualification : </td>
<td>".$_POST['qualification']."</td>
</tr>
<tr>
<td style='font-weight:bold'>University : </td>
<td>".$_POST['university']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Year : </td>
<td>".$_POST['year']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Qualification : </td>
<td>".$_POST['qualification_2']."</td>
</tr>
<tr>
<td style='font-weight:bold'>University : </td>
<td>".$_POST['university_2']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Year : </td>
<td>".$_POST['year_2']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Qualification : </td>
<td>".$_POST['qualification_3']."</td>
</tr>
<tr>
<td style='font-weight:bold'>University : </td>
<td>".$_POST['university_3']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Year : </td>
<td>".$_POST['year_3']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Discipline Information (School) : </td>
<td>".$_POST['discipline']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Discipline Information (Violation) : </td>
<td>".$_POST['violation']."</td>
</tr>
<tr>
<td style='font-weight:bold'>12th Mark List : </td>
<td>".$_POST['attachment1']."</td>
</tr>
<tr>
<td style='font-weight:bold'>12th Passing Certificate : </td>
<td>".$_POST['attachment2']."</td>
</tr>
<tr>
<td style='font-weight:bold'>10th Mark List : </td>
<td>".$_POST['attachment3']."</td>
</tr>
<tr>
<td style='font-weight:bold'>10th Passing Certificate : </td>
<td>".$_POST['attachment4']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Address Proof : </td>
<td>".$_POST['attachment8']."</td>
</tr>
<tr>
<td style='font-weight:bold'>Photographs : </td>
<td>".$_POST['attachment9']."</td>
</tr>
<table>";
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$mail->MsgHTML($body);
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
//$mail->Host = "saxena#designmaniac.in"; // SMTP server
//$mail->Username = "name#domain.com"; // SMTP server username
//$mail->Password = "password"; // SMTP server password
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("saxena#designmaniac.in");
$mail->AltBody = "To view the message, please use an HTML compatible email
viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->AddAttachment($_FILES['fileToUpload']['tmp_name'],
$_FILES['fileToUpload']['name']);
$mail->IsHTML(true); // send as HTML
$mail->Send();
echo 'Thank You. Your form has been submitted';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
?>
This is my html file.
<!DOCTYPE HTML>
<html>
<head>
<title>Student Admission Form</title>
<link href="css/admn_form.css" rel="stylesheet">
<script>
function showMe(e) {
var strdisplay = e.options[e.selectedIndex].value;
var e = document.getElementById("idShowMe");
if(strdisplay == "Online Payment") {
e.style.display = "block";
} else {
e.style.display = "none";
}
}
</script>
</head>
<body>
<form name="admissionForm" id="admissionForm"
class="form-inline" action="php/email_handler_attachments.php"
method="post" enctype='multipart/form-data'>
<fieldset>
<div class="container">
<center><label><h1 class="well" style="color:#fff44f;">Admission Application</h1></label>
</center><div class="col-lg-12 well">
<div class="row">
<form>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6 form-group">
<table>
<label>Course Details</label>
<p>
<tr>
<th>Course Applied For*</th>
<th>
<select name="course" id="course" required>
<option value=""></option>
<option value="B.Sc. in Media Graphics & Animation">B.Sc. in Media Graphics & Animation</option>
<option value="Diploma in Filmology">Diploma in Filmology</option>
<option value="Post Graduate Diploma in Graphic Multimedia Animation">Post Graduate Diploma in Graphic Multimedia Animation</option>
<option value="Diploma in Visual Effects (VFX)">Diploma in Visual Effects (VFX)</option>
<option value="Diploma in Int-Ext Apps">Diploma in Int-Ext Apps</option>
<option value="Advance Diploma in Software Development">Advance Diploma in Software Development</option>
<option value="Diploma in Web Design & Development">Diploma in Web Design & Development</option>
<option value="Diploma in Multimedia">Diploma in Multimedia</option>
<option value="Diploma in Fine Arts">Diploma in Fine Arts</option>
</th>
</select>
</tr>
</p>
<p>
<tr>
<th>Payment Mode*</th>
<th>
<select name="p_mode" id="p_mode" class="form-control" required>
<option value=""></option>
<option value="Lump Sum">Lump Sum</option>
<option value="Yearly">Yearly</option>
<option value="Semester Wise">Semester Wise</option>
<option value="Monthly Payment">Monthly Payment</option>
</th>
</select>
</tr>
</p>
<p>
<tr>
<th>Payment Options*</th>
<th>
<select onchange="showMe(this);" name="p_option" id="p_option" class="form-control">
<option value=""></option>
<option value="Online Payment">Online Payment</option>
<option value="Cheque/Demand Draft">Cheque/Demand Draft</option>
<option value="Cash Payment">Cash Payment</option>
</th>
</select>
</p>
</table>
<table>
<tr>
<div id="idShowMe" style="display: none"><br />
Proceed To Payment
</div>
</tr>
</table>
</div>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
<div class="row">
<div class="col-sm-6 form-group">
<p>
<label>Personal Information</label>
</p>
<table>
<tr>
<th>First Name*</th>
<th>Middle Name*</th>
<th>Last Name*</th>
</tr>
<tr>
<td><input type="text" name="name_f" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
<td><input type="text" name="name_m" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
<td><input type="text" name="name_l" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
</tr>
<p>(Please enter your name as it appears in your S.S.C/H.S.C. or other official documents.)
</p>
<tr>
<th>E-mail id*</th>
<th></th>
<th>Date of Birth*</th>
</tr>
<tr>
<td><input type="text" name="email" id="email" type="email" pattern="[A-Za-z0-9._%+-]+#[A-Za-z0-9.-]+\.[A-Za-z]{1,63}$" placeholder="" class="form-control" required></td>
<td></td>
<td><input type="date" value""... name="date" id="date" placeholder=""style="width:395px;height:37px;border-radius: 4px"; required class="form-control"></td>
</tr>
<tr>
<th>Gender*</th>
<th></th>
<th>Marital Status*</th>
</tr>
<tr>
<td><select name="gender" id="gender" required>
<option value=""></option>
<option value="Male">Male</option>
<option value="Female">Female</option></td>
</select>
<td></td>
<td><select name="gender_marital" id="gender" required>
<option value=""></option>
<option value="Single">Single</option>
<option value="Married">Married</option></td>
</select>
</tr>
<tr>
<th>Nationality*</th>
<th></th>
<th>If Foreign National Give Your Passport and Visa Details</th>
</tr>
<tr>
<td><select name="nationality" id="nationality" required>
<option value=""></option>
<option value="Indian">Indian</option>
<option value="Foreign National">Foreign National</option></td>
</select>
<td>
<td><input type="text" name="visa" id="visa" type="text" placeholder="" class="form-control"></td>
</tr>
</table>
</div>
</div>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
<div class="row">
<div class="col-sm-6 form-group">
<p>
<label>Permanent Address</label>
</p>
<table>
<tr>
<th>Address Line 1*</th>
<th></th>
<th>Address Line 2</th>
</tr>
<tr>
<td><textarea placeholder="" name="address_line1" id="address_line1" type="text" rows="3" style="height:33px"; class="form-control" required></textarea>
</td>
<td></td>
<td><textarea placeholder="" name="address_line2" id="address_line2" type="text" rows="3" style="height:33px"; class="form-control"></textarea>
</tr>
<tr>
<th>City / Town*</th>
<th></th>
<th>Zip / Postal Code*</th>
</tr>
<tr>
<td><input type="text" id="address_line2" name="city" type="text" required placeholder="" class="form-control"></td>
<td></td>
<td><input type="text" id="address_line2" name="zip" type="number" pattern="^([0-9]{1,12})$" title='Zip Code (Format: 123456)' required placeholder="" class="form-control"></td>
</tr>
<tr>
<th>State / Province*</th>
<th></th>
<th>Country*</th>
</tr>
<tr>
<td><input type="text" id="address_line2" name="state" type="text" placeholder="" class="form-control" required></td>
<td></td>
<td><input type="text" id="address_line2" name="country" type="text" placeholder="" class="form-control" required></td>
</tr>
<tr>
<th>Phone Number</th>
<th></th>
<th>Mobile Number*</th>
</tr>
<tr>
<td><input type="text" name="phone_number" id="phone" type="number" placeholder="Begin with Area or Country Code.." class="form-control"></td>
<td></td>
<td><input type="text" name="mobile_number" id="mobile" type="number" pattern='[\+]\d{2}\d{2}\d{8}' title='Phone Number (Format: +919999999999)'
placeholder="" class="form-control" required></td>
</tr>
</table
</div>
</div>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<p>
<label>Parent Information</label>
</p>
<p>
<table>
<b>Father's / Mother's Details</b>
</p>
<tr>
<th>First Name*</th>
<th>Middle Name*</th>
<th>Last Name*</th>
</tr>
<tr>
<td><input type="text" id="p_name" name="fname_f" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
<td><input type="text" id="p_name" name="fname_m" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
<td><input type="text" id="p_name" name="fname_l" type="text" pattern ="[a-z,A-Z, ]*" placeholder="" class="form-control" required></td>
</tr>
<tr>
<th>E-mail id</th>
<th></th>
<th>Mobile Number*</th>
</tr>
<tr>
<td><input type="text" type="email" name="email1" id="email1" placeholder="" class="form-control"></td>
<td></td>
<td><input type="text" name="mobile_number1" id="mobile" type="number" pattern='[\+]\d{2}\d{2}\d{8}' title='Phone Number (Format: +919999999999)'
placeholder="" class="form-control"></td>
</tr>
<tr>
<th>Profession</th>
<th></th>
<th>Position</th>
</tr>
<tr>
<td><input type="text" name="profession" id="prof" type="text" placeholder="" class="form-control"></td>
<td></td>
<td><input type="text" name="position" id="psn" type="text" placeholder="" class="form-control"></td>
</tr>
</table>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
<div class="row">
<div class="col-sm-6 form-group">
<p>
<label>Your Academic Details</label>
</p>
<table>
<tr>
<th>Qualification</th>
<th>University / Board</th>
<th>Year</th>
</tr>
<tr>
<td><input type="text" name="qualification" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="university" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="year" id="board" type="number" placeholder="" class="form-control"></td>
</tr>
<tr>
<th>Qualification</th>
<th>University / Board</th>
<th>Year</th>
</tr>
<tr>
<td><input type="text" name="qualification_2" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="university_2" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="year_2" id="board" type="number" placeholder="" class="form-control"></td>
</tr>
<tr>
<th>Qualification</th>
<th>University / Board</th>
<th>Year</th>
</tr>
<tr>
<td><input type="text" name="qualification_3" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="university_3" id="board" type="text" placeholder="" class="form-control"></td>
<td><input type="text" name="year_3" id="board" type="number" placeholder="" class="form-control"></td>
</tr>
</table>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
<div class="row">
<div class="col-sm-4 form-group">
<p>
<label>Discipline Information*</label>
</p>
<table>
<tr>
<td>Have you ever been placed on probation, suspended, removed,
dismissed or expelled from<br> any school or academic program since 10th grade?</td>
<td><input type="radio" name="discipline" value="yes" class="form-control required">Yes
<input type="radio" name="discipline" value="no" class="form-control" required>No</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Have you ever been charged with a violation of the law which resulted in,<br> or if still
pending could result in, probation, a jail sentence,<br> or the revocation or suspension
of your driver’s license<br> (including traffic violations which resulted in a fine of Rs.200 or more?)</td>
<td><input type="radio" name="violation" value="yes" class="form-control" required>Yes
<input type="radio" name="violation" value="no" class="form-control" required>No</td>
</tr>
</table>
<table>
_________________________________________________________________________________________________________________________________________________________________________________________________
</table>
<div class="row">
<div class="col-sm-6 form-group">
<p>
<label>Attachments</label>
</p>
<table>
<tr>
<td>12th Mark List</td>
<td><input type="checkbox" name="attachment1" value="12th Mark list"></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td>12th Passing Certificate(To be submitted after receiving from school)</td>
<td><input type="checkbox" name="attachment2" value="12th Mark list"></td>
</tr>
<tr>
<td>10th Mark List</td>
<td><input type="checkbox" name="attachment3" value="10th Mark list"></td>
</tr>
<tr>
<td>10th Passing Certificate</td>
<td><input type="checkbox" name="attachment4" value="10th Mark list"></td>
</tr>
<tr>
<td>Migration Certificate</td>
<td><input type="checkbox" name="attachment5" value="migration certificate"></td>
</tr>
<tr>
<td>Transfer Certificate</td>
<td><input type="checkbox" name="attachment6" value="transfer certificate"></td>
</tr>
<tr>
<td>Gap Certificate</td>
<td><input type="checkbox" name="attachment7" value="gap certificate"></td>
</tr><tr>
<td>Address Proof</td>
<td><input type="checkbox" name="attachment8" value="address proof"></td>
</tr>
<tr>
<td>Photographs</td>
<td><input type="checkbox" name="attachment9" value="photographs"></td>
</tr>
</table>
<table>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<p>
<label>Please Select the Files to Upload</label>
<td><input type="file" name="fileToUpload" id="fileToUpload" size="40"></td>
</p>
</tr>
</table>
<center><p>
<input type="submit" name="Submit" value="submit">
</p>
</center>
</div>
</div>
</div>
</form>
</body>
</html>
Also can somebody help me on this. How can I allow the user to attach multiple files. What will be the php for this? Could you please help me on this also? I have learnt a lot today. I know that I have to add multiple in input file and the name should be "name[]". Now you have both my html as well as php file. Saxena
just add condition like this
if(isset($_FILES['fileToUpload']['tmp_name']) && $_FILES['fileToUpload']['tmp_name'] != "") {
$mail->AddAttachment($_FILES['fileToUpload']['tmp_name'],
$_FILES['fileToUpload']['name']);
}
Add condition to check attachment
if(!empty($_FILES) && !empty($_FILES['fileToUpload'])) {
$mail->AddAttachment($_FILES['fileToUpload']['tmp_name'],
$_FILES['fileToUpload']['name']);
}
........
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("saxena#designmaniac.in");
$mail->AltBody = "To view the message, please use an HTML compatible email
viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
if(!empty($_FILES['fileToUpload']['tmp_name']) && !empty($_FILES['fileToUpload']['name'])) {
$mail->AddAttachment($_FILES['fileToUpload']['tmp_name'],
$_FILES['fileToUpload']['name']);
}
$mail->IsHTML(true); // send as HTML
$mail->Send();
echo 'Thank You. Your form has been submitted';
} catch (phpmailerException $e) {
echo $e->errorMessage();
.......

Pass variable from form to next page and put in sql statment php

Here is what I am trying to do. I have a dropdown (and or excel type look) that I need to pull data from the database. When I have an item selected I need to pass the info to the next page via a session. I have the drop down pulling from the database but I need to list Name and address in the dropdown.
If this is not possible I can do a list of items from a search but I will need to make the id a link to pass the id to the next page where I need to build a report.
If you can give me some info on this I would appreciate it.
Here is what I have for code on the dropdown
Code: Select all
<?php
// declare database connection variables.
$host = "localhost";
$username = "root";
$password = "";
$db_name = "sample";
$tbl_name = "tbl_report";
// connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql = "SELECT id, name, address FROM $tbl_name";
$result = mysql_query($sql) or die(mysql_error());
$dropdown = "<form action='report.php' method='post'>";
$dropdown .= "<select name='items' class='select'>";
while ($row = mysql_fetch_assoc($result)) {
$dropdown .= '<option value="' . $row['id'] . '">' .
$row['name'] . ' - ' . $row['address'] . '</option>';;
}
$dropdown .= "\r\n</select>";
$dropdown .= "<input type='submit' name='submit' value='Submit'>";
$dropdown .= "</form>"; //closing the form tag
echo $dropdown;
?>
What I need to do is pass the ID to the next page and have the $id show up in the code for my next sql statement.
Here is the code that I have for the next page sql statement.
select * from $tbl_name where id = (this is where I get hung up on.)
What I need is a way to pass the $row['id'] to the next page and put that in the sql code and then use the get method to display the info on the form of that page.
Here is the setup of the pages. select-report.php (this is where the drop down is) --> report.php.
Here is the form for report.php where i need to carry over the value of id and do a sql of select * from $tbl_name where id=[$post=items]; Then i need to use the $get to put all the items in the form below:
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td width="20%">Water Purveyor
<input name="water-purveyor" type="text" id="water-purveyor" size="35" />
</td>
<td colspan="2">Facility Contact
<input type="text" name="facility-contact" id="facility-contact" /></td>
<td colspan="2">Facility Address
<input type="text" name="facility-address" id="facility-address" /></td>
</tr>
<tr>
<td>Manufacturer
<input type="text" name="manufacturer" id="manufacturer" /></td>
<td width="20%">State
<select name="state" id="state">
</select></td>
<td width="20%">Model #
<input name="model-num" type="text" id="model-num" size="10" /></td>
<td width="20%">Serial #
<input name="serial-num" type="text" id="serial-num" size="10" /></td>
<td width="20%">Meter #
<input name="meter-num" type="text" id="meter-num" size="10" /></td>
</tr>
<tr>
<td>Owner
<input type="text" name="owner" id="owner" /></td>
<td>Phone #
<input name="phone-num" type="text" id="phone-num" size="12" /></td>
<td>Caged
<input type="checkbox" name="caged" id="caged" /></td>
<td>Locked
<input type="checkbox" name="locked" id="locked" /></td>
<td>Code key
<input name="code-key" type="text" id="code-key" size="6" /></td>
</tr>
<tr>
<td colspan="2">Owner Address
<input name="owner-address" type="text" id="owner-address" size="50" /></td>
<td>Owner City
<input type="text" name="owner-city" id="owner-city" /></td>
<td>Owner State
<select name="owner-state" id="owner-state">
</select></td>
<td>Owner Zip
<input name="owner-zip" type="text" id="owner-zip" size="10" /></td>
</tr>
<tr>
<td>Contact
<input type="text" name="contact" id="contact" /></td>
<td>Contact Phone
<input name="contact-phone" type="text" id="contact-phone" size="10" /></td>
<td> </td>
<td>Other</td>
<td> </td>
</tr>
<tr>
<td colspan="2">Facility Name
<input name="facility-name" type="text" id="facility-name" size="40" /></td>
<td colspan="3">Assembly Address
<input name="assembly-address" type="text" id="assembly-address" size="75" /></td>
</tr>
<tr>
<td colspan="5">Onsite Location
<input name="onsite-location" type="text" id="onsite-location" size="75" /></td>
</tr>
<tr>
<td colspan="5">email Address
<input name="email" type="text" id="email" size="125" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>SHUTOFF VALVES</td>
<td colspan="2"><table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td>N/A</td>
<td>Good</td>
<td>Poor</td>
<td>Fail</td>
</tr>
</table></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Valve 1</td>
<td colspan="2"><table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td><input type="checkbox" name="v1-na" id="v1-na" /></td>
<td><input type="checkbox" name="v1-good" id="v1-good" /></td>
<td><input type="checkbox" name="v1-poor" id="v1-poor" /></td>
<td><input type="checkbox" name="v1-fail" id="v1-fail" /></td>
</tr>
</table></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Valve 2</td>
<td colspan="2"><table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td><input type="checkbox" name="v2-na" id="v2-na" /></td>
<td><input type="checkbox" name="v2-good" id="v2-good" /></td>
<td><input type="checkbox" name="v2-poor" id="v2-poor" /></td>
<td><input type="checkbox" name="v2-fail" id="v2-fail" /></td>
</tr>
</table></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Assembly Replacement?
<input type="checkbox" name="assembly-replacement" id="assembly-replacement" /></td>
<td>if yes Serial #
<input type="text" name="assembly-replacement-serial" id="assembly-replacement-serial" /></td>
<td>New Installation
<input type="checkbox" name="new-install" id="new-install" /></td>
<td>Permit #
<input type="text" name="permit-num" id="permit-num" /></td>
<td> </td>
</tr>
<tr>
<td>Containment
<input type="checkbox" name="containment" id="containment" /></td>
<td>Isolation
<input type="checkbox" name="isolation" id="isolation" /></td>
<td colspan="2">Assembly Ground Clearance
<input type="text" name="assembly-ground-clearance" id="assembly-ground-clearance" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Domestic
<input type="checkbox" name="domestic" id="domestic" /></td>
<td>Irrigation
<input type="checkbox" name="irrigation" id="irrigation" /></td>
<td>Fire Line
<input type="checkbox" name="fire-line" id="fire-line" /></td>
<td>Alarmed Fire Line
<input type="checkbox" name="alarmed-fire-line" id="alarmed-fire-line" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><strong><em><u>Double Check Balve Assembly Repair</u></em></strong></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Repairs</td>
<td>Check Valve 1</td>
<td> </td>
<td>Check Valve 2</td>
<td> </td>
</tr>
<tr>
<td rowspan="3"> </td>
<td>Cleaned
<input type="checkbox" name="cv1-repair-cleaned" id="cv1-repair-cleaned" /></td>
<td> </td>
<td>Cleaned
<input type="checkbox" name="cv2-repair-cleaned" id="cv2-repair-cleaned" /></td>
<td> </td>
</tr>
<tr>
<td><strong>Replaced</strong></td>
<td> </td>
<td><strong>Replaced</strong></td>
<td> </td>
</tr>
<tr>
<td>Rubber Kit
<input type="checkbox" name="cv1-rubber-kit" id="cv1-rubber-kit" /></td>
<td> </td>
<td>Rubber Kit
<input type="checkbox" name="cv2-rubber-kit" id="cv2-rubber-kit" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Other
<input type="checkbox" name="cv1-other" id="cv1-other" /></td>
<td> </td>
<td>Other
<input type="checkbox" name="cv2-other" id="cv2-other" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2">Comments
<textarea name="cv1-other-comments" id="cv1-other-comments" cols="45" rows="5"></textarea></td>
<td colspan="2">Comments
<textarea name="cv2-other-comments" id="cv2-other-comments" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Initial Test By
<input name="initial-test-by" type="text" id="initial-test-by" size="50" /></td>
<td colspan="2">Certified Tester #
<input type="text" name="certified-tester-num" id="certified-tester-num" /></td>
<td>Test Date/Time
<input type="text" name="test-date-time" id="test-date-time" /></td>
</tr>
<tr>
<td>Pass
<input type="checkbox" name="initial-test-pas" id="initial-test-pas" /></td>
<td>Fail
<input type="checkbox" name="initial-test-fail" id="initial-test-fail" /></td>
<td colspan="2">Calib Expire Date
<input type="text" name="calib-expire-date" id="calib-expire-date" /></td>
<td>Guage Serial #
<input type="text" name="gague-serial-num" id="gague-serial-num" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Repair Test By
<input name="repair-test-by" type="text" id="repair-test-by" size="50" /></td>
<td colspan="2">Repair Date/Time
<input type="text" name="repair-date-time" id="repair-date-time" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Final Test by
<input name="final-test-by" type="text" id="final-test-by" size="50" /></td>
<td colspan="2">Certified Tester #
<input type="text" name="ft-certified-tester-num" id="ft-certified-tester-num" /></td>
<td>Test Date/Time
<input type="text" name="ft-date-time" id="ft-date-time" /></td>
</tr>
<tr>
<td>Pass
<input type="checkbox" name="ft-pass" id="ft-pass" /></td>
<td>Fail
<input type="checkbox" name="ft-fail" id="ft-fail" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="5">Comments
<textarea name="comments" id="comments" cols="80" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">Video upload <input type="file" name="uploadvideo" /></td>
<td colspan="2">Image 1 <input type="file" name="uploadimage" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Image 2 <input type="file" name="uploadimage2" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Image 3 <input type="file" name="uploadimage3" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Image 4 <input type="file" name="uploadimage4" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2">Image 5 <input type="file" name="uploadimage5" /></td>
<td> </td>
</tr>
</table>
</form>
you can use jquery when to get the selected value like this
$("#dropdownid").change(function({ var vals = $(this).val(); })
then when you are redirecting to next page then add it as get parameter
(report.php)
if(isset($_REQUEST['submit'])){
$option = $_POST['items'];
mysql_query("SELECT * FROM `table_name` WHERE FIELD_NAME = '$options'");
}
if(isset($_REQUEST['submit'])){
$option = $_REQUEST['items'];
mysql_query("SELECT * FROM `table_name` WHERE FIELD_NAME = '$options'");
}
You can pass value to next page using php session.
$_SESSION ['name'] = $value;
and you can get value using php session from next page.
$value = $_SESSION ['name'];

Edit Database in PHP-Site

I'm very new to php and databases. So I need you to help me out please.
I want to edit the data of my database online in my php site. But the form is empty and I don't know why.
I don't know if you need more information so this is the code of the table with the form. If you need more let me know.
<table>
<?php
$con=mysqli_connect("x","y","z","xyz");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Transparente");
while($row = mysqli_fetch_array($result))
mysqli_close($con);
?>
<form method="post" action="edit_data.php">
<input type="text" name="id" value="<? echo "$row[id]"?>">
<tr>
<td>Firma</td>
<td>
<input type="text" name="name"
size="40" value="<? echo "$row[Name]"?>">
</td>
</tr>
<tr>
<td>Wer</td>
<td>
<input type="text" name="wer" size="40"
value="<? echo "$row[Wer]"?>">
</td>
</tr>
<tr>
<td>Erhalten</td>
<td>
<input type="text" name="erhalten" size="40"
value="<? echo "$row[Erhalten]"?>">
</td>
</tr>
<tr>
<td>Digital</td>
<td>
<input type="text" name="digital" size="40"
value="<? echo "$row[Digital]"?>">
</td>
</tr>
<tr>
<td>Betrag in Euro</td>
<td>
<input type="text" name="betrag" size="40"
value="<? echo "$row[Betrag]"?>">
</td>
</tr>
<tr>
<td>Bezahlt am</td>
<td>
<input type="text" name="bezahlt" size="40"
value="<? echo "$row[Bezahlt]"?>">
</td>
</tr>
<tr>
<td>Anmerkung</td>
<td>
<input type="text" name="anmerkung" size="40"
value="<? echo "$row[Anmerkung]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>
</table>
Try below code
1)If data base contain more rows it shows multiple form
2)You need to show one form you need to restrict in query using where class
<?php
$con=mysqli_connect("x","y","z","xyz");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Transparente");
while($row = mysqli_fetch_array($result))
{
?>
<table>
<form method="post" action="edit_data.php">
<input type="text" name="id" value="<?php echo $row['id'];?>">
<tr>
<td>Firma</td>
<td>
<input type="text" name="name"
size="40" value="<?php echo $row['Name'];?>">
</td>
</tr>
<tr>
<td>Wer</td>
<td>
<input type="text" name="wer" size="40"
value="<?php echo $row['Wer']?>">
</td>
</tr>
<tr>
<td>Erhalten</td>
<td>
<input type="text" name="erhalten" size="40"
value="<?php echo $row['Erhalten']?>">
</td>
</tr>
<tr>
<td>Digital</td>
<td>
<input type="text" name="digital" size="40"
value="<?php echo $row['Digital']?>">
</td>
</tr>
<tr>
<td>Betrag in Euro</td>
<td>
<input type="text" name="betrag" size="40"
value="<?php echo $row['Betrag']?>">
</td>
</tr>
<tr>
<td>Bezahlt am</td>
<td>
<input type="text" name="bezahlt" size="40"
value="<?php echo "$row[Bezahlt]"?>">
</td>
</tr>
<tr>
<td>Anmerkung</td>
<td>
<input type="text" name="anmerkung" size="40"
value="<?php echo $row['Anmerkung'];?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>
</table>
<?php } ?>
Edit:
change query like below
$result = mysqli_query($con,"SELECT * FROM Transparente where id={$_REQUEST['id']}");
<table>
<?php
$con=mysqli_connect("x","y","z","xyz");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Transparente");
while($row = mysqli_fetch_array($result))
?>
<form method="post" action="edit_data.php">
<input type="text" name="id" value="<? echo "$row[id]"?>">
<tr>
<td>Firma</td>
<td>
<input type="text" name="name"
size="40" value="<? echo "$row[Name]"?>">
</td>
</tr>
<tr>
<td>Wer</td>
<td>
<input type="text" name="wer" size="40"
value="<? echo "$row[Wer]"?>">
</td>
</tr>
<tr>
<td>Erhalten</td>
<td>
<input type="text" name="erhalten" size="40"
value="<? echo "$row[Erhalten]"?>">
</td>
</tr>
<tr>
<td>Digital</td>
<td>
<input type="text" name="digital" size="40"
value="<? echo "$row[Digital]"?>">
</td>
</tr>
<tr>
<td>Betrag in Euro</td>
<td>
<input type="text" name="betrag" size="40"
value="<? echo "$row[Betrag]"?>">
</td>
</tr>
<tr>
<td>Bezahlt am</td>
<td>
<input type="text" name="bezahlt" size="40"
value="<? echo "$row[Bezahlt]"?>">
</td>
</tr>
<tr>
<td>Anmerkung</td>
<td>
<input type="text" name="anmerkung" size="40"
value="<? echo "$row[Anmerkung]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>
</table>
<?php mysqli_close($con);?>
// close connection at the end of the code
You are not opening the while loop.Try this it will show you the values in the form
<table>
<?php
$con=mysqli_connect("x","y","z","xyz");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Transparente");
while($row = mysqli_fetch_array($result))
{
mysqli_close($con);
?>
<form method="post" action="edit_data.php">
<input type="text" name="id" value="<? echo "$row[id]"?>">
<tr>
<td>Firma</td>
<td>
<input type="text" name="name"
size="40" value="<? echo "$row[Name]"?>">
</td>
</tr>
<tr>
<td>Wer</td>
<td>
<input type="text" name="wer" size="40"
value="<? echo "$row[Wer]"?>">
</td>
</tr>
<tr>
<td>Erhalten</td>
<td>
<input type="text" name="erhalten" size="40"
value="<? echo "$row[Erhalten]"?>">
</td>
</tr>
<tr>
<td>Digital</td>
<td>
<input type="text" name="digital" size="40"
value="<? echo "$row[Digital]"?>">
</td>
</tr>
<tr>
<td>Betrag in Euro</td>
<td>
<input type="text" name="betrag" size="40"
value="<? echo "$row[Betrag]"?>">
</td>
</tr>
<tr>
<td>Bezahlt am</td>
<td>
<input type="text" name="bezahlt" size="40"
value="<? echo "$row[Bezahlt]"?>">
</td>
</tr>
<tr>
<td>Anmerkung</td>
<td>
<input type="text" name="anmerkung" size="40"
value="<? echo "$row[Anmerkung]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit"
name="submit value" value="Edit">
</td>
</tr>
</form>
</table>
<?php }?>

how to get the value for my html email form?

Ihave this code that send an email with attachmant and its was working fine, but i did change the message body to have an email with a form look the problem i can't get the data to be showen in mt text box
$rowSQL = mysql_query( "SELECT MAX( ID ) AS max FROM `consulta` ;" );
$row = mysql_fetch_array( $rowSQL );
$largestNumber = $row['max'];
//echo $largestNumber;
$allData = mysql_query("SELECT * FROM `consulta` WHERE ID = $largestNumber;" );
while($rows = mysql_fetch_array($allData)) {
$email =$rows['EMAIL'];
$depto = $rows['N_DPTO'];
// NEW
$nombre = $rows['NOMBRE1'];
$apeellido = $rows['APELLIDO1'];
$dni = $rows['DNI'];
$phone = $rows['TELF'];
$direccion = $rows['DIRECCION'];
$date = $rows['DATE'];
$refrencia = $rows['REFERENCIA'];
$nestac = $rows['N_ESTACIONAMIENTO'];
$deposito = $rows['N_DEPOSITO'];
$dptoprice = $rows['P_DPTO'];
$esprice = $rows['P_ESTACIONAMIENTO'];
$depoprice = $rows['P_DEPOSITO'];
$separacion = $rows['SEPARACION'];
$cuota = $rows['CUOTA'];
$montofin = $rows['MONTO_FIN'];
$entidadfin = $rows['ENTIDAD_FIN'];
$observacion = $rows['OBSERVACIONES'];
$ncotizacion = $rows['N_COTIZACION'];
$user = $rows['USER_ID'];
// END NEW
echo $email;
echo $depto;
}
and the HTML message :
$message = '<html>
<body>
<table width="639" border="0">
<tr>
<td height="38" colspan="6"><h2>Gracias por tu visita
<label for="dpto"></label>
</h2></td>
</tr>
<tr>
<td width="148">Depto</td>
<td width="144"><input name="dpto" type="text" id="dpto" value="<?php echo $depto;?>" /></td>
<td width="3"> </td>
<td width="8"> </td>
<td width="136">Vendedor</td>
<td width="174" nowrap="nowrap"><label for="cotizacion">
<input name="user" type="text" id="user" value="" />
</label></td>
</tr>
<tr>
<td>Fecha</td>
<td><label for="esta">
<input name="date" type="text" id="date" value="$" />
</label></td>
<td> </td>
<td> </td>
<td>Documento</td>
<td nowrap="nowrap"><label for="deposito">
<input name="cotizacion" type="text" id="cotizacion" value="$" />
</label></td>
</tr>
<tr>
<td>Estacionamiento</td>
<td><input name="esta" type="text" id="esta" value="$" /></td>
<td> </td>
<td> </td>
<td>Deposito</td>
<td nowrap="nowrap"><input name="deposito" type="text" id="deposito" value="$" /></td>
</tr>
<tr>
<td height="64" colspan="6" valign="middle"><h2>Datos Del Cliente</h2></td>
</tr>
<tr>
<td>Nombre</td>
<td><input name="name" type="text" id="name2" value="$" /></td>
<td> </td>
<td> </td>
<td>Apellido</td>
<td nowrap="nowrap"><input name="family" type="text" id="family" value="$" /></td>
</tr>
<tr>
<td>DNI</td>
<td><input name="dni" type="text" id="dni" value="$" /></td>
<td> </td>
<td> </td>
<td> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td height="32">Telf</td>
<td><input name="telf" type="text" id="telf" value="$" /></td>
<td> </td>
<td> </td>
<td>Email</td>
<td nowrap="nowrap"><input name="email" type="text" id="email" value="$" /></td>
</tr>
<tr>
<td>Direccion</td>
<td colspan="5"><input name="address" type="text" id="address" value="$" size="74" /></td>
</tr>
<tr>
<td>Como se Entero</td>
<td colspan="5"><input name="como" type="text" id="como" value="$" size="74" /></td>
</tr>
<tr>
<td height="56" colspan="6"><h2>Datos Financieros</h2></td>
</tr>
<tr>
<td>Precio Dpto S/.</td>
<td><input name="pDpto" type="text" id="pDpto" value="$" /></td>
<td> </td>
<td> </td>
<td>Precio Estacio S/.</td>
<td nowrap="nowrap"><input name="pEsta" type="text" id="pEsta" value="$" /></td>
</tr>
<tr>
<td>Precio Deposito S/.</td>
<td><input name="pDeposito" type="text" id="pDeposito" value="$" /></td>
<td> </td>
<td> </td>
<td>Separacion S/.</td>
<td nowrap="nowrap"><input name="separacion" type="text" id="separacion" value="$" /></td>
</tr>
<tr>
<td>Cuota S/.</td>
<td><input name="couta" type="text" id="couta" value="$" /></td>
<td> </td>
<td> </td>
<td>Monto Financia</td>
<td nowrap="nowrap"><input name="monto" type="text" id="monto" value="$" /></td>
</tr>
<tr>
<td>Entidad Financia</td>
<td><input name="entidad" type="text" id="entidad" value="$" /></td>
<td> </td>
<td> </td>
<td> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td>Observaciones</td>
<td colspan="5"><textarea name="oserv" id="oserv" cols="58" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td nowrap="nowrap"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td nowrap="nowrap"> </td>
</tr>
</table>
</body>
</html>';
i do get the form look email but in the textbox i get so how can i have to show the value in the text box ???
The html form is a php string so you will have to end it to display the php value:
<input name="dpto" type="text" id="dpto" value="'.$depto.'" />
notice the single quote and dot before the variable $depto then the dot and single quote after. when you output the $message variable it will output the value of $depto
You need to reference the variables that contain the text you want to display, and because you're using single quotes instead of double quotes you have to close the quotes on your $message and use the single dot to join the variable with your text, like this:
<textarea name="oserv" id="oserv" cols="58" rows="5">'.$oserv.'</textarea>
Or:
<input name="date" type="text" id="date" value="'.$date.'" />
For future reference, if you used double quotes, you could reference the variables like this (but you'd need to escape all double quotes in your string with a \):
$message = "<input name=\"date\" type=\"text\" id=\"date\" value=\"{$date}\" />";

HTML form submits to php user gets email but my email is blank

I have a form that submits and send 2 emails: one email to the customer to confirm and the other email to my sales staff.
The email to the customer works just fine, and displays the name and email that are entered in the form in the body of the email
The email to my sales staff lists the information entered on the form. However, when the email is sent to my sales email address the body of the email shows up blank.
HTML:
<form id="RFQ" method="post" action="RFQ-result.php">
<h1 align="center">Request a Quote</h1>
<table width="640" border="0" cellpadding="2" align="center">
<tr>
<td height="32" colspan="6"><strong>PROJECT INFORMATION</strong></td>
</tr>
<tr>
<td width="14"> </td>
<td width="120" align="right">Project Name:</td>
<td colspan="4"><span id="spryProjectName">
<input name="ProjectName" type="text" id="ProjectName" size="50" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right"><label for="Company2">Company:</label></td>
<td colspan="4"><span id="spryCompany">
<input name="Company" type="text" id="Company" size="40" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right">Address:</td>
<td colspan="4"><span id="spryAddress">
<input name="Address" type="text" id="Address" size="50" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right">City: </td>
<td><span id="spryCity">
<input type="text" name="City" id="City" />
<span class="textfieldRequiredMsg">*</span></span></td>
<td width="1"> </td>
<td width="135" align="right">State / Province:</td>
<td width="154"><span id="spryState">
<input type="text" name="State" id="State" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right">Postal Code:</td>
<td width="178"><span id="spryZip">
<input name="Zip" type="text" id="Zip" size="10" maxlength="6" />
<span class="textfieldRequiredMsg">*</span></span></td>
<td> </td>
<td align="right">Country: </td>
<td><input type="text" name="Country" id="Country" /></td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td> </td>
<td> </td>
<td align="right"> </td>
<td> </td>
</tr>
</table>
<table width="640" border="0" cellpadding="2" align="center">
<tr>
<td height="32" colspan="6"><strong>CONTACT INFORMATION</strong></td>
</tr>
<tr>
<td width="15"> </td>
<td width="121" align="right">First Name:</td>
<td width="173"><span id="spryFirstName">
<input name="FirstName" type="text" id="FirstName" size="20" />
<span class="textfieldRequiredMsg">*</span></span></td>
<td width="1"> </td>
<td width="89" align="right">Last Name:</td>
<td width="203"><span id="spryLastName">
<input type="text" name="LastName" id="LastName" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right">Phone:</td>
<td><span id="spryPhone">
<input name="Phone" type="text" id="Phone" size="20" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
<td> </td>
<td align="right"><label for="Mobile2">Mobile:</label></td>
<td><span id="spryMobile">
<input name="Mobile" type="text" id="Mobile" size="20" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*Invalid format</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right">E-mail: </td>
<td colspan="4"><span id="spryEmail">
<input name="Email" type="text" id="Email" size="40" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right"> </td>
<td colspan="4"> </td>
</tr>
</table>
<table width="640" border="0" cellpadding="2" align="center">
<tr> </tr>
</table>
<table width="640" border="0" cellpadding="2" align="center">
<tr>
<td height="33" colspan="5"><strong>STANDARD CONFIGURATION</strong></td>
</tr>
<tr>
<td> </td>
<td width="156" colspan="2" align="right">Location of Drive:</td>
<td width="437" colspan="2"><span id="spryDriveCity">
<label for="DriveCity"></label>
<input type="text" name="DriveCity" id="DriveCity" />
<span class="textfieldRequiredMsg">*</span></span>, <span id="spryDriveState">
<label for="DriveState"></label>
<input type="text" name="DriveState" id="DriveState" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Temperature Range:</td>
<td colspan="2"><span id="spryMinTemp">
<label for="MinTemp"></label>
<input name="MinTemp" type="text" id="MinTemp" size="5" />
- <span class="textfieldRequiredMsg">*</span></span><span id="spryMaxTemp">
<label for="MaxTemp"></label>
<input name="MaxTemp" type="text" id="MaxTemp" size="5" />
<span class="textfieldRequiredMsg">*</span></span> °C</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Altitude:</td>
<td colspan="2"><span id="spryAltitude">
<label for="Altitude"></label>
<input name="Altitude" type="text" id="Altitude" size="5" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format</span></span> ft</td>
</tr>
<tr>
<td width="15"> </td>
<td colspan="2" align="right"><label for="PumpType">Type of Application:</label></td>
<td colspan="2"><span id="spryPumpType">
<select name="PumpType" id="PumpType">
<option> </option>
<option value="Beam Pump">Beam Pump</option>
<option value="Progressive Cavity Pump">Progressive Cavity Pump</option>
<option value="Rotaflex Pump">Rotaflex Pump</option>
<option value="Submersible Pump">Submersible Pump</option>
<option value="Surface Centrifugal Compressor">Surface Centrifugal Compressor</option>
<option value="Surface Centrifugal Pump">Surface Centrifugal Pump</option>
<option value="Surface Reciprocating Compressor">Surface Reciprocating Compressor</option>
<option value="Surface Reciprocating Pump">Surface Reciprocating Pump</option>
</select>
<span class="selectRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Drive Manufacturer:</td>
<td colspan="2"><span id="spryManufacturer">
<label for="Manufacturer"></label>
<input name="Manufacturer" type="text" id="Manufacturer" size="25" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Model No:</td>
<td colspan="2"><span id="spryModel">
<label for="Model3"></label>
<input name="Model" type="text" id="Model3" size="20" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Speed Range:</td>
<td colspan="2"><span id="sprytextfield18">
<label for="MinSpeed"></label>
<input name="MinSpeed" type="text" id="MinSpeed" size="10" />
<span class="textfieldRequiredMsg">*</span></span> - <span id="spryMaxSpeed">
<label for="MaxSpeed"></label>
<input name="MaxSpeed" type="text" id="MaxSpeed" size="10" />
<span class="textfieldRequiredMsg">*</span></span> ft/sec</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Input Voltage:</td>
<td colspan="2"><span id="spryInputVoltage">
<label for="InputVoltage"></label>
<select name="InputVoltage" id="InputVoltage">
<option> </option>
<option value="200-240 VAC Input">200-240 VAC Input</option>
<option value="380-500 VAC Input">380-500 VAC Input</option>
<option value="525-690 VAC Input">525-690 VAC Input</option>
</select>
<span class="selectRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Input Phase:</td>
<td colspan="2"><span id="spryInputPhase">
<select name="InputPhase" id="InputPhase">
<option> </option>
<option value="Single Phase">Single Phase</option>
<option value="Three Phase">Three Phase</option>
</select>
<span class="selectRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Frequency:</td>
<td colspan="2"><span id="spryFrequency">
<label for="Frequency"></label>
<input name="Frequency" type="text" id="Frequency" size="10" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> Hz</td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">kW:</td>
<td colspan="2"><span id="sprykW">
<label for="kW"></label>
<input name="kW" type="text" id="kW" size="10" />
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">HP:</td>
<td colspan="2"><span id="spryHP">
<label for="HP"></label>
<input name="HP" type="text" id="HP" size="5"/>
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">kVA:</td>
<td colspan="2"><span id="sprykVA">
<label for="kVA"></label>
<input name="kVA" type="text" id="kVA" size="5" width="75"/>
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right">Amps:</td>
<td colspan="2"><span id="spryAmps">
<label for="Amps3"></label>
<input name="Amps" type="text" id="Amps3" size="5" width="75"/>
<span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid format.</span> </span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="right"> </td>
<td colspan="2"> </td>
</tr>
</table>
<table width="640" border="0" cellpadding="2" align="center">
<tr>
<td height="32" colspan="5" align="left"><strong>OPTIONS</strong></td>
</tr>
<tr>
<td width="14"> </td>
<td colspan="4" align="left">Enclosure & Environment Options:</td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td width="237"><input type="checkbox" name="Shield" id="Shield" />
<label for="Shield">Sun/Snow Sheild</label></td>
<td width="15"> </td>
<td width="327"><input type="checkbox" name="ColdKit" id="ColdKit" />
<label for="ColdKit">Cold Weather Kit (-40 to -50 °C)</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td><input type="checkbox" name="WallStand" id="WallStand" />
<label for="WallStand">Wall Mounting Stand</label></td>
<td> </td>
<td><input type="checkbox" name="HeatKit" id="HeatKit" />
<label for="HeatKit">Heat Trace Kit</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td><input type="checkbox" name="FloorBase" id="FloorBase" />
<label for="FloorBase">Floor Mounting Base</label></td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td width="15" align="left"> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="left">Input:</td>
<td colspan="2">Output:</td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td><input type="checkbox" name="PowerKit" id="PowerKit" />
<label for="PowerKit">Power Terminal Kit.</label></td>
<td> </td>
<td><input type="checkbox" name="MotorKit" id="MotorKit" />
<label for="MotorKit">Motor Terminal Kit</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td><input type="checkbox" name="Harmonic" id="Harmonic" />
<label for="Harmonic">Harmonic Filter Enclosure</label></td>
<td> </td>
<td><input type="checkbox" name="SineFilter" id="SineFilter" />
<label for="SineFilter">Sine Filter Enclosure</label></td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="left"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="left">VFD:</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="Fieldbus" id="Fieldbus" />
<label for="Fieldbus">Fieldbus Networks</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="ControlKit" id="ControlKit" />
<label for="ControlKit">Control Terminal Kit</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="General" id="General" />
<label for="General">General Purpose I/O, 3DI, 2DO, 2AI, 1AO</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="Relay" id="Relay" />
<label for="Relay">Relay Option, 3RO, 240Vac, 2A</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="DCSupply" id="DCSupply" />
<label for="DCSupply">24 V Ext. DC Supply Connector</label></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2" align="left">Operation & Support:</td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td colspan="3"><input type="checkbox" name="iCM" id="iCM" />
<label for="iCM">SALT iCM (remote access internect control module)</label></td>
</tr>
</table>
<blockquote>
<p align="right">
<input name="Submit" type="submit" id="Submit" value="Submit"/>
</p>
</blockquote>
</form>
PHP:
<?php
$ProjectName = $_POST['ProjectName'];
$Company = $_POST['Company'];
$Address = $_POST['Address'];
$City = $_POST['City'];
$State = $_POST['State'];
$Zip = $_POST['Zip'];
$Country = $_POST['Country'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Phone = $_POST['Phone'];
$Mobile = $_POST['Mobile'];
$Email = $_POST['Email'];
$DriveCity = $_POST['DriveCity'];
$DriveState = $_POST['DriveState'];
$MinTemp = $_POST['MinTemp'];
$MaxTemp = $_POST['MaxTemp'];
$Altitude = $_POST['Altitude'];
$PumpType = $_POST['PumpType'];
$Manufacturer = $_POST['Manufacturer'];
$Model = $_POST['Model'];
$MinSpeed = $_POST['MinSpeed'];
$MaxSpeed = $_POST['MaxSpeed'];
$InputVoltage = $_POST['InputVoltage'];
$InputPhase = $_POST['InputPhase'];
$Frequency = $_POST['Frequency'];
$kW = $_POST['kW'];
$HP = $_POST['HP'];
$kVA = $_POST['kVA'];
$Amps = $_POST['Amps'];
$Shield = $_POST['Shield'];
$WallStand = $_POST['WallStand'];
$FloorBase = $_POST['FloorBase'];
$ColdKit = $_POST['ColdKit'];
$HeatKit = $_POST['HeatKit'];
$PowerKit = $_POST['PowerKit'];
$Harmonic = $_POST['Harmonic'];
$MotorKit = $_POST['MotorKit'];
$SineFilter = $_POST['SineFilter'];
$Fieldbus = $_POST['Fieldbus'];
$ControlKit = $_POST['ControlKit'];
$General = $_POST['General'];
$Relay = $_POST['Relay'];
$DCSupply = $_POST['DCSupply'];
$iCM = $_POST['iCM'];
//Sending Email to form owner
$header = "From: $Email\n"
. "Reply-To: $Email\n";
$subject = "SALT RFQ";
$email_to = "sales#pmcsalt.com";
$message = "Project Name: $ProjectName\n" . "Company: $Company\n" . "Address: $Address\n" . "City: $City\n" . "State: $State\n" . "Zip: $Zip\n" . "Country: $Country\n" . "First Name: $FirstName\n" . "Last Name: $LastName\n" . "Phone: $Phone\n" . "Mobile: $Mobile\n" . "Email: $Email\n" .
"Drive City: $DriveCity\n" .
"Drive State: $DriveState\n" .
"Min Temp: $MinTemp\n" .
"Max Temp: $MaxTemp\n" .
"Altitude: $Altitude\n" .
"Application Type: $PumpType\n" .
"Manufacturer: $Manufacturer\n" .
"Model: $Model\n" .
"MinSpeed: $MinSpeed\n" .
"MaxSpeed: $MaxSpeed\n" .
"InputVoltage: $InputVoltage\n" .
"InputPhase: $InputPhase\n" .
"kW: $kW\n" .
"HP: $HP\n" .
"kVA: $kVA\n" .
"Amps: $Amps\n" .
"Sun/Snow Shield: $Shield\n" .
"Wall Mounting Stand: $WallStand\n" .
"Floor Mounting Base: $FloorBase\n" .
"Cold Weather Kit: $ColdKit\n" .
"Heat Trace Kit: $HeatKit\n" .
"Power Terminal Kit: $PowerKit\n" .
"Harmonic Filter Enclosure: $Harmonic\n" .
"Motor Terminal Kit: $MotorKit\n" .
"Sine Filter Enclosure: $SineFilter\n" .
"Fieldbus Networks: $Fieldbus\n" .
"Control Terminal Kit: $ControlKit\n" .
"General Purpose I/O, 3DI, 2DO, 2AI, 1AO: $General\n" .
"Relay Option, 3RO, 240Vac, 2A: $Relay\n" .
"24 V Ext. DC Supply Connector: $DCSupply\n" .
"SALT iCM: $iCM\n" .
mail($email_to, $subject ,$message ,$header ) ;
//Sending Confirmation Email to Client
$header = "From: sales#pmcsalt.com\n"
. "Reply-To: sales#pmcsalt.com\n";
$subject = "SALT RFQ";
$email_to = "$Email";
$message = "Dear $FirstName $LastName,\n \n We have received your pricing request for $ProjectName. One of our sales representatives will be with you within 48 hours to discuss pricing for your custom application.\n \n Thank you for chosing Power Management Controls!! \n \n \n";
mail($email_to, $subject ,$message ,$header ) ;
?>
You're not terminating your concatentation properly:
"24 V Ext. DC Supply Connector: $DCSupply\n" .
"SALT iCM: $iCM\n" .
mail($email_to, $subject ,$message ,$header ) ;
This should be:
24 V Ext. DC Supply Connector: $DCSupply\n" .
"SALT iCM: $iCM\n";
mail($email_to, $subject ,$message ,$header ) ;
At the moment, you've not got anything in $message at the point where you're calling mail().

Categories