JQuery Append form not posting in PHP - php

I am trying to append table row which contains HTML form. The append form data not passing to controller. My Code is -
<form method="post" action="<?=base_url()?>controller/function_name">
<table class="table table-bordered tbsize tb_wp" id="">
<thead>
<tr >
<th class="firstrow">Item No.</th>
<th class="firstrow">Part No.</th>
<th class="firstrow">Qty</th>
<th class="firstrow">Price Quoted </th>
<th class="firstrow"> Notes </th>
<th class="firstrow">Internal Notes</th>
<th colspan="3" class="firstrow2">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Customer RFQ</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th colspan="3" class="firstrow3">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Customer P/O</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th colspan="3" class="firstrow4">
<div class="pcrsec">
<div class="row"><span class="pcrsecbor">Perior Vendor P/O</span></div>
<div class="row">
<div class="pcrsec2">
<ul class="list-inline">
<li>Date</li>
<li>Cust No</li>
<li>Price</li>
</ul>
</div>
</div>
</div>
</th>
<th class="firstrow">MU%</th>
<th></th>
</tr>
</thead>
<tbody id="what_i_do">
<tr>
<td><input type="text" name="item_no[]"></td>
<td colspan="3">
<table>
<tr>
<td><input type="text" class="smlbox" name="part_no[]" onblur="checkavailpart(this)"></td>
<td><input type="number" class="smlbox" name="qty[]"></td>
<td>
<input type="number" class="smlbox price_quotd_cls" name="price_quotd[]">
</td>
</tr>
<tr>
<td colspan="3"><input type="text" class="smlbox2" name="part_desc[]"></td>
</tr>
</table>
</td>
<td><input type="text" name="part_note[]"></td>
<td><input type="text" name="part_internal_note[]"></td>
<td><input type="text" class="datepicker" name="pc_rfq_date[]"></td>
<td><input type="text" name="pc_rfq_cus_no[]"></td>
<td><input type="text" name="pc_rfq_price[]"></td>
<td><input type="text" class="datepicker" name="pc_po_date[]"></td>
<td><input type="text" name="pc_po_cus_no[]"></td>
<td><input type="text" name="pc_po_price[]"></td>
<td><input type="text" class="datepicker" name="pv_po_date[]"></td>
<td><input type="text" name="pv_po_cus_no[]"></td>
<td><input type="text" name="pv_po_price[]"></td>
<td><input type="text" name="mu_per[]" onblur="calculate_quote_rate(this)"></td>
<td><i class="fa fa-plus-circle fa-2x" onclick="what_i_do(this);"></i></td>
</tr>
</tbody>
</form>
And JQuery is:-
<script>
function what_i_do(that) {
initid++;
var objTo = document.getElementById('what_i_do');
var divtest = document.createElement("tr");
divtest.setAttribute("class", "removeclass" + initid);
divtest.setAttribute("id", "removeclass" + initid);
var rdiv = 'removeclass' + initid;
divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td><input type="text" class="smlbox" name="part_no[]" onblur="checkavailpart(this)"></td><td><input type="number" class="smlbox" name="qty[]"></td><td> <input type="number" class="smlbox price_quotd_cls" name="price_quotd[]"> </td></tr><tr> <td colspan="3"><input type="text" class="smlbox2" name="part_desc[]"></td></tr></table> </td><td><input type="text" name="part_note[]"></td><td><input type="text" name="part_internal_note[]"></td><td><input type="text" class="datepicker" name="pc_rfq_date[]"></td><td><input type="text" name="pc_rfq_cus_no[]"></td><td><input type="text" name="pc_rfq_price[]"></td><td><input type="text" class="datepicker" name="pc_po_date[]"></td><td><input type="text" name="pc_po_cus_no[]"></td><td><input type="text" name="pc_po_price[]"></td><td><input type="text" class="datepicker" name="pv_po_date[]"></td><td><input type="text" name="pv_po_cus_no[]"></td><td><input type="text" name="pv_po_price[]"></td><td><input type="text" name="mu_per[]" onblur="calculate_quote_rate(this)"></td><td><i class="fa fa-times-circle fa-2x" style="color:red" onclick="remove_education_fields(' + initid + ');"></i></td>';
objTo.appendChild(divtest);
}
</script>
When I am submitting the form I use to get only zero index data. I have tried to clone the table row but there also I am not getting the value of the form which have been appended by the JQuery.
Please Help me out of this Problem
Thank You in advance.

in your appended html :
divtest.innerHTML = '<td><input type="text" name="item_no[]"></td><td colspan="3"> <table> <tr> <td>.....
remove all spaces between tags

First make sure that your submit button is inside form tag,
then you can just append your html code inside tbody tag :
#what_i_do refer to tbody tag
$("#what_i_do tr").append('<tr class="removeclass'+id+'" id="removeclass'+id+'">'+ 'html code'+ '</tr>');

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();
.......

get_cellmap() issue with DomPDF

I'm working with DomPdf and trying to convert my file into pdf but facing a strange error given below
I googled many times and read different forums but didn't get the reason for this error.
Please help me guys.
Fatal error: Uncaught Error: Call to a member function get_cellmap()
on null in
C:\xampp\htdocs\dom\dompdf\src\FrameReflower\TableCell.php:37 Stack
trace: #0
C:\xampp\htdocs\dom\dompdf\src\FrameDecorator\AbstractFrameDecorator.php(893):
Dompdf\FrameReflower\TableCell->reflow(NULL) #1
C:\xampp\htdocs\dom\dompdf\src\FrameReflower\TableRow.php(52):
Dompdf\FrameDecorator\AbstractFrameDecorator->reflow() #2
C:\xampp\htdocs\dom\dompdf\src\FrameDecorator\AbstractFrameDecorator.php(893):
Dompdf\FrameReflower\TableRow->reflow(NULL) #3
Code
require_once './dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
$dompdf->loadHtml(file_get_contents('./my-file.php'));
$dompdf->setPaper('A4','landscape');
$dompdf->render();
$dompdf->stream('codexworld',array('Attachment'=>0));
my-file.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="page-wrap">
<form method="post" action="save_view.php" novalidate="">
<div id="header">
<h2 class="title" style="text-decoration: underline;font-size:2em;font-family: Brush Script Mt;">Pro Tech Diagnostics</h2>
<!-- <img id="image" width="auto" src="images/Logo.png" alt="logo" height="60"/>-->
<div class="adjust_contact">
<p>26893 Bouquet Canyon Rd. Suite C204 Saugus, CA 91350</p>
<div class="parent">
<p class="left">Phone # (818)644-1965</p>
<p class="right">Fax # (661) 468-7504</p>
</div>
</div>
</div>
<div id="identity">
<div id="header1">
<h3>Customer Info</h3>
</div>
</div>
<div style="clear:both"></div>
<!-- <textarea id="customer-title">Widget Corp.
c/o Steve Widget</textarea>-->
<div id="customer">
<div id="parent">
<table id="meta" style="overflow: wrap" class="left1">
<tr>
<td class="meta-head">Name</td>
<td>
<input name="name" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">Address</td>
<td>
<input name="address" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">Phone</td>
<td>
<input required="required" name="phone" type="text"/>
</td>
</tr>
</table>
<table id="meta" style="overflow: wrap" class="right1">
<tr>
<td class="meta-head">Invoice#</td>
<td>
<input required="required" name="invoice" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">Paid Date</td>
<td>
<input required="required" name="date" type="text"/>
</td>
</tr>
</table>
</div>
</div>
<!-----------------------3 columns Table Section------------------------->
<div id="identity">
<div id="header1-1">
<h3>Vehicle Info</h3>
</div>
</div>
<div class="Row">
<div class="Column">
<table id="meta" style="overflow: wrap" class="left1">
<span class="parent">
<tr>
<td class="meta-head">Make:</td>
<td>
<input required="required" name="make" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">Model:</td>
<td>
<input required="required" name="model" type="text"/>
</td>
</tr>
</span>
<tr>
<td class="meta-head">Year:</td>
<td>
<input required="required" name="year" type="text"/>
</td>
</tr>
</table>
</div><!--1st table-->
<div class="Column">
<table id="meta" style="overflow: wrap" class="left1">
<span class="parent">
<tr>
<td class="meta-head">Vin #:</td>
<td>
<input required="required" name="vin" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">Lic.#:</td>
<td>
<input required="required" name="lic" type="text"/>
</td>
</tr>
</span>
<tr>
<td class="meta-head">Miles:</td>
<td>
<input required="required" name="miles" type="text"/>
</td>
</tr>
</table>
</div><!--2nd table-->
<div class="Column">
<table id="meta" style="overflow: wrap" class="left1">
<span class="parent">
<tr>
<td class="meta-head">Color:</td>
<td>
<input required="required" name="color" type="text"/>
</td>
</tr>
<tr>
<td class="meta-head">R.O. #:</td>
<td>
<input required="required" name="ro" type="text"/>
</td>
</tr>
</span>
<tr>
<td class="meta-head">P.O. #:</td>
<td>
<input required="required" name="po" type="text"/>
</td>
</tr>
</table>
</div><!--3rd table-->
</div><!--End 3 column table row-->
<table id="items" style="overflow: wrap; margin-top: 100px;">
<tr>
<th colspan="6">Descryption</th>
<th>Hrs</th>
<th colspan="1">Amount</th>
</tr>
<tr class="item-row">
<td colspan="6" class="item-name">
<textarea style="padding-bottom: 300px;" name="description" rows="12" cols="5"></textarea>
<p style="font-weight: bold">*******All Parts Supplied By Shop*******</p>
</td>
<td>
<input name="hrs" type="text"/>
</td>
<td colspan="5">
<input required="required" name="amount" type="text"/>
</td>
</tr>
<tr>
<td colspan="4">Technician #: 81 (Miguel A.)</td>
<td style="border: none;" colspan="2">Labor Hrs:</td>
<td colspan="1"><input placeholder="0" name="labourHrs" type="text"/></td>
<td colspan="1"></td>
</tr>
<tr>
<td colspan="2">Labor Rate (Per Hr):</td>
<td colspan="2"><input placeholder="60" required="required" name="labourRate" type="text"/></td>
<td style="border: none;" colspan="2">Labor Price:</td>
<td colspan="1"><input placeholder="0" name="labourPrice" type="text"/></td>
<td colspan="1"></td>
</tr>
<tr>
<td style="border: none;" colspan="4"></td>
<td style="border: none;" colspan="2">Total</td>
<td colspan="1"></td>
<td colspan="1"><input placeholder="0" name="total" type="text"/></td>
</tr>
<tr>
<td style="border: none" colspan="4"></td>
<td colspan="3">Grand Total</td>
<td colspan="1"><input placeholder="$0.00" name="gTotal" type="text"/></td>
</tr>
<tr>
<td colspan="4">Signature Approval:</td>
<td colspan="4"></td>
</tr>
<tr>
<td style="border: none" colspan="4"></td>
<td style="border-right: none;" colspan="4">Paid</td>
</tr>
<tr class="no-border">
<td colspan="4"></td>
<td></td>
<td >Yes<input type="checkbox" name="one" value="Yes( ✓ )"></td>
<td>No ( )<input type="checkbox" name="two" value="No( ✓ )"></td>
<td>P.O. ( )<input type="checkbox" name="three" value="P.O( ✓ )"></td>
</tr>
<tr>
<td colspan="8">
<p style="font-size: 10px">Not responsible for loss by fire or theft or any other cause beyond our control. I hereby authorize the above repair work to be done with the necessary material & grant
permission to operate equipment for purpose of testing and inspection. An express mechanic's lien is acknowledged to secure the amount of repairs. I agree to pay
the payment in full no later than 30 days after work has been completed. After 30 days, a 1.4% monthly charge will be added to the outstanding balance.
</p>
</td>
</tr>
</table>
</div>
<h2 style="text-decoration: underline;font-style: italic;text-align: center; font-weight: bold;font-family: Brush Script Mt;">
Thanks for Your Business
</h2>
<input name="submit" class="submit" type="submit" value="Submit"/>
</form>
</body>
</html>
DomPDF make conflict with CSS properties like display
I don't know why but try to remove display properties
If you are using table and you are facing this problem then
There are two tricks which work for me.
I don't know if this trick is correct solutions or not.
Check Number of td should be same in all tr inside your table.
If you have used tfooter then remove that tfooter and place that tr inside tbody.
It might help you.
I thought that was table-bordered, a CSS issue, but was HTML, I had thead and tr tags, I removed thead tag:
before:
<thead>
<tr>
...
</tr>
</thead>
...
after:
<tr>
...
</tr>
Worked for me.
I didn't find out, because with little data (10) worked fine but with more data (15-20) it returned this error
I found this issue caused by CSS (I had padding in mm)
Got this error, too. Reasons was a malformed html, sonw rows had a colspan="4", but other rowd only three , also and were missing.
When I fixed the html, the error was gone.
I also had this issue and when I removed all responsive part or css from the table tag then it's work properly.
So remove this part style="overflow: wrap" from your Table tag.

Submitting Form To Email and Redirecting Not Working

I need help with this php code... it doesn't redirect to the specified url
<?php
if(isset($_POST['submit'])){
$to = "email#domain.com"; // this is your Email address
$firstName = $_POST['$inf_tTzSYWEgQfQ4dJf9'];
$lastName = $_POST['lastName'];
$phoneNumber = $_POST['phoneNumber'];
$company = $_POST['company'];
$addressLine1 = $_POST['addressLine1'];
$addressLine2 = $_POST['addressLine2'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];
$emailAddress = $_POST['emailAddress'];
$subject = "New Order - " . $firstName . " " . $lastName;
$body = "First Name: $firstName\n Last Name: $lastName\n Phone Number: $phoneNumber\n Company: $company\n Address Line 1: $addressLine1 \n Address Line 2: $addressLine2 \n City: $city\n State: $state\n Country: $country\n Email Address:$emailAddress";
header('Location: http://stackoverflow.com/');
}
?>
here's the HTML form
<form method="post" name="orderForm" id="orderForm" action="ordersubmithandler.php">
<div id="header">
<div class="CUSTOM_HTML">
<div id="customHeader">
</div>
</div>
<div id="IMAGE">
<div id="companyLogoTopBanner">
<img src="orderpage_files/jp126-666e1bad-894a-41bd-9d30-be234e2bf638-v2.png">
</div>
</div>
</div>
<div id="content">
<input id="previewMode" name="previewMode" type="hidden" value="false">
<div id="ORDER_FORM_PRODUCT_LIST">
<table class="viewCart tabular grid">
<tbody>
<tr>
<th class="leftAlign">Products</th>
<th></th>
<th class="rightAlign priceCell">Price</th>
<th class="centerAlign qtyCell">Quantity</th>
<th class="rightAlign priceCell">Total</th>
</tr>
<tr>
<td colspan="2" class="productCell">
<h1>Lorem ip</h1>
<p class="productDescription">Lorem ipLorem ipLorem ipLorem ipLorem ipLorem ipLorem ipLorem ip</p>
<span class="subscriptionPlan">One Time Payment of $80.00</span>
</td>
<td class="rightAlign priceCell">
<span class="price">$80.00</span>
</td>
<td class="centerAlign qtyCell">1 </td>
<td class="rightAlign priceCell">$80.00</td>
</tr>
<tr class="subtotal">
<td class="leftAlign"><span class="totalPrice">Subtotal</span></td>
<td co="" colspan="2"></td>
<td class="qtyCell"></td>
<td class="rightAlign priceCell"><span class="priceBold">$80.00</span></td>
</tr>
</tbody>
</table>
</div>
<div id="CUSTOM_HTML">
<div id="productInformation">
<input name="" type="checkbox" checked="yes" value=""> <font color="black"><b> I understand and agree I will be charged one payment today of $80.00 as FULL payment for the product. </b></font><b> <br> <br>
</b></div>
</div>
<b>
<div id="UP_SELLS">
</div>
<div id="ORDER_FORM_BILLING_ENTRY">
<link href="./orderpage_files/anti_spam.jsp" rel="stylesheet" type="text/css">
<script type="text/javascript">(function() {
var styleArray = ["/css/anti_spam.jsp"];
if (window.Infusion) {
Infusion.stylesLoaded(styleArray);
} else if (window.InfusionStyles) {
window.InfusionStyles.concat(styleArray);
} else {
window.InfusionStyles = styleArray;
}
})();</script>
<div id="orderFormBillingEntry">
<table class="billingTable tabular grid">
<tbody>
<tr>
<th colspan="2" class="leftAlign">Billing Information</th>
</tr>
<tr>
<td class="rightAlignTop"><label class="checkoutLabel">* First Name</label></td>
<td>
<input class="regula-validation checkoutTop" data-constraints="#Required(label="First Name", groups=[customer])" id="firstName" name="firstName" size="10" type="text">
<input class="inf_a2f0ec38ba2014366540402764cde59e" id="inf_tTzSYWEgQfQ4dJf9" name="inf_tTzSYWEgQfQ4dJf9" type="text">
</td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">* Last Name</label></td>
<td><input class="regula-validation checkout" data-constraints="#Required(label="Last Name", groups=[customer])" id="lastName" name="lastName" size="12" type="text"></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">Company Name</label></td>
<td><input class="checkout" id="company" name="company" size="25" type="text"></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">* Address - Line 1</label></td>
<td><input class="regula-validation checkout" data-constraints="#Required(label="Address - Line 1", groups=[customer])" id="addressLine1" name="addressLine1" size="25" type="text"></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">Address - Line 2</label></td>
<td><input class="checkout" id="addressLine2" name="addressLine2" size="25" type="text"></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">* City</label></td>
<td><input class="regula-validation checkout" data-constraints="#Required(label="City", groups=[customer])" id="city" name="city" size="15" type="text"></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel"><div id="stateRequired">* State</div></label></td>
<td><select class="regula-validation checkout" data-constraints="#StateRequiredForSpecificCountries(countryFieldName="country", label="State", groups=[customer])" id="state" name="state" data-on="Component.Select"><option value="Lagos">Lagos</option></select></td>
</tr>
<tr>
<td class="rightAlign"><label class="checkoutLabel">* Country</label></td>
<td><select class="regula-validation checkout" data-constraints="#Required(label="Billing Country", groups=[customer])" id="country" name="country" data-on="Component.Select"><option value="Nigeria">Nigeria</option></select></td>
</tr>
<tr>
<td class="rightAlign">* Phone Number</td>
<td><input class="regula-validation checkout" data-constraints="#Required(label="Phone Number", groups=[customer])" id="phoneNumber" name="phoneNumber" size="25" type="text"></td>
</tr>
<tr>
<td class="rightAlign">* Email Address</td>
<td><input class="regula-validation checkoutBottom" data-constraints="#Required(label="Email Address", groups=[customer]) #Email(label="Email Address", groups=[customer])" id="emailAddress" name="emailAddress" size="15" type="text"></td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">jQuery(document).ready(function() {
var $country = jQuery('#country');
if ($country.val() == 'United States' || $country.val() == 'Canada') {
jQuery('#stateRequired').html('* State');
}
if ($country.length > 0 && "SELECT" == $country.get(0).tagName) {
$country.change(function() {
if ($country.val() == 'United States' || $country.val() == 'Canada') {
jQuery('#stateRequired').html('* State');
} else {
jQuery('#stateRequired').html('State');
}
});
}
});
jQuery('#addressLine1, #city, #zipCode, #country, #state').change(function() {
Infusion.Ecomm.OrderForms.submitFormUponChangeOnBilling('orderForm', 'Profit-Academy-2015--Payment-Plan', 'RENDER_ORDER_FORM');
});</script>
</div>
<div id="ORDER_FORM_SHIPPING_ENTRY">
<div id="orderFormShippingEntry">
</div>
</div>
<div id="SHIPPING_OPTIONS">
<div id="shippingOptionsContainer">
</div>
</div>
<div id="PAYMENT_PLANS">
</div>
<div id="ORDER_FORM_SUMMARY">
<table class="orderSummary tabular grid">
<tbody>
<tr>
<th class="leftAlign">Summary Of What You Are Getting</th>
<th class="rightAlign"></th>
</tr>
<tr>
<td colspan="2">
<img src="bonus.png">
</td>
</tr>
<tr>
<th class="leftAlign">Order Summary</th>
<th class="rightAlign"></th>
</tr>
<tr>
<td class="listCell">Subtotal</td>
<td class="rightAlign">$80.00</td>
</tr>
<tr>
<td class="subtotal">Total Due</td>
<td class="rightAlign subtotal">$80.00</td>
</tr>
</tbody>
</table>
</div>
<div id="PAYMENT_SELECTION">
<table class="paymentMethodTable tabular grid">
<tbody>
<tr>
<td>
<button type="submit" style="align-content: center"><img src="bbbbbb.png" alt="a"></button>
</td>
</tr>
</tbody>
</table>
</div>
</b>
</div>
<b>
<br clear="all">
<div id="footer">
<div id="CUSTOM_HTML">
<div id="customFooter">
<!--<center><img src="./orderpage_files/payment-logos.jpg" alt="a"></center> --><br>
<center>
<font color="red">NOTICE: <i></i></font><i><font color="black"><b>Lorem ipsum, Please contact us at: mail#mail.com</b></font></i><b>
<br> <br>
<font color="black"><b>Copyright © . All rights reserved.<br></b></font>
<br>
<br>
<font color="black"><b> NEED HELP? Please contact us at: mail#mail.com </b></font></b>
</center>
<b><font color="black"></font></b>
</div>
<b><font color="black"></font></b>
</div>
<b><font color="black"></font></b>
</div>
<b><font color="black"></font></b>
</b>
</form>
I have tried editing severally but haven't been able to figure out what is wrong with the code.
Need help with this... thanks!
Your help is REALLY REALLY appreciated :)
It may not be working because your button isn't called "submit"
<button type="submit" style="align-content: center">
Try putting name = "submit" in there..
Plus, you could always put some debug in the php code, so it echo'd out what its doing to check values are what you thought.. Also, you set a bunch of variables and do nothing with it - didnt you mean to actually send the email?
$_POST['$inf_tTzSYWEgQfQ4dJf9']; with the $ in the array shouldn't be there, because of it being treated as another variable.
Then your submit button isn't named which is why your code isn't executing inside the first conditional statement.
You need to add the name attribute for it, as in name="submit".

Using tabbed pane for multiple form data insertion from php into mysql

I am creating an application in Html, php with Mysql. On one of my webform I am using Tabs created with Radio buttons as tab heads to select the tab perticular tab. I am facing the issue to insert tab1 values into the database while other 4 tabs fire same query and their data is easily inserted. Its the problem with the 1st Tab only and I realized it when I changed the tabs order. Please help me I want to work with Tabbed pane to provide multiple input forms to the user. Thanks in advance.
Here here is my web form Tab1.php
<form action="" enctype="multipart/form-data" method="post">
<table width="100%" border="0" align="center">
<tr>
<td> Date </td>
<td><input type="DATE" required name="ClaimDate"/></td>
</tr>
<tr>
<td>From</td>
<td><input type="text" maxlength="" required size="20" Placeholder="Source" name="ClaimFrom"></td>
<td align="center">To</td>
<td><input type="text" size="20" maxlength="" required Placeholder="Destination" name="ClaimTo"></td>
</tr>
<tr>
<td>Amount</td>
<td><input type="number" size="5" name="ClaimAmt" required Placeholder="In Rupees" ></td>
<td colspan = 3><input type="file" name="ClaimReceipt"></td>
</tr>
<tr>
<td colspan="6" ><table border="0" Width="30%" height=40px >
<tr>
<td width="20%" ><input type="submit" name="Add" value="Add"></td>
<td width="20%" ><input name="AdBtn3" type="reset" value="clear" width="48" height="40" ></td>
</tr>
</table></td>
</tr>
</table>
</form>
InsertData.php
include('dbcon.php');
$User = 'abc';
$ExCategory = mysql_real_escape_string($_REQUEST['ExCategory']);
$ClaimDate = mysql_real_escape_string($_REQUEST['ClaimDate']);
if(isset($_REQUEST['ClaimFrom']) && isset($_REQUEST['ClaimTo']))
{
$ClaimFrom = mysql_real_escape_string($_REQUEST['ClaimFrom']);
$ClaimTo = mysql_real_escape_string($_REQUEST['ClaimTo']);
}
$ClaimAmt = mysql_real_escape_string($_REQUEST['ClaimAmt']);
$ClaimClass = mysql_real_escape_string($_REQUEST['ClaimClass']);
$ClaimReceipt = $_FILES['ClaimReceipt']['size'];
$ClaimRowid = "";
if (isset($_POST['Add']))
{
mysql_query("INSERT INTO `test`.`tbluserexpenses` VALUES('$User','$ExCategory','$ClaimDate','$ClaimFrom','$ClaimTo','$ClaimAmt','$ClaimClass','$ClaimReceipt','$ClaimRowid');");
}
<div style="position:relative; z-index:1; top:85px; left:390px;"><ul class="tabs">
<li>
<input type="radio" name="tabs" id="tab1" checked />
<label for="tab1">Local</label>
<div id="tab-content1" class="tab-content">
<?php include 'Tab1.php';?>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab2" />
<label for="tab2">Express</label>
<div id="tab-content2" class="tab-content">
<?php include 'Tab2.php';?>
</div>
</li>
This way Tab1.php is attached to my mainform as a tabbed pane.

How do I submit a Web page with PHP?

I've created a three step order form and I need help with the third step.
1. form is filled out by the business and clicks on "preview order"
2. business views their order and clicks "confirm" (should be on "bizform.php" but I haven't tried it because I have no clue on how to do it.)
3. by clicking "confirm" the "Web page" or data from "bizform.php" is sent to the business and myself.
Questions: Is it possible? If so, can you point me in the right direction? TYVM
My form:
<div class="span4 diff">
<h3>Business Information</h3>
<br/>
<form action="bizform.php" method="post">
<label for="bizName" class="control-label">
Business:</label>
<input type="text" id="bizName" name="bizName" class="input-large">
<label for="bizAddress" class="control-label">
Business Address:</label>
<input type="text" id="bizAddress" name="bizAddress" class="input-large">
<label for="bizCity" class="control-label">
City:</label>
<input type="text" id="bizCity" name="bizCity" class="input-large">
<label for="bizState" class="control-label">
State:</label>
<input type="text" id="bizState" name="bizState" class="input-large">
<label for="bizZip" class="control-label">
Zip code:</label>
<input type="text" id="bizZip" name="bizZip" class="input-large">
<label for="fullName" class="control-label">
Full Name:</label>
<input type="text" id="fullName" name="fullName" class="input-large">
<label for="bizEmail" class="control-label">
E-mail:</label>
<input type="text" id="bizEmail" name="bizEmail" class="input-large">
</div>
<div class="span7">
<h3>Choose Products</h3>
<br/>
<table class="table table-bordered table-striped">
<thead>
<tr class="diffhead">
<th>Product</th>
<th>Price</th>
<th>Training</th>
<th>Total</th>
<th>Qty</th>
</tr>
</thead>
<tbody>
<tr>
<td>Product One</td>
<td>$1000.00</td>
<td>$100.00</td>
<td>$1100.00</td>
<td>
<label class="input" for="productOne"></label>
<input type="text" class="input-mini" value="0" id="productOne" name="productOne">
</td>
</tr>
<tr>
<td>Product Two</td>
<td>$1000.00</td>
<td>$100.00</td>
<td>$1100.00</td>
<td>
<label class="input" for="productTwo"></label>
<input type="text" class="input-mini" value="0" id="productTwo" name="productTwo">
</td>
</tr>
<tr>
<td>Product Three</td>
<td>$1000.00</td>
<td>$100.00</td>
<td>$1100.00</td>
<td>
<label class="input" for="productThree"></label>
<input type="text" class="input-mini" value="0" id="productThree" name="productThree">
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-actions">
<button class="btn btn-danger" type="reset" style="float:left">
<i class="icon-remove-sign icon-white"></i> Cancel Order</button>
<button class="btn btn-primary" type="submit" style="float:right">Preview Order
<i class="icon-circle-arrow-right icon-white"></i></button>
</form>
<?php
include '_inc/footer.html';
?>
My form processor:
<?php
include '_inc/header.html';
?>
<?php
$bizName = $_POST['bizName'];
$bizAddress = $_POST['bizAddress'];
$bizCity = $_POST['bizCity'];
$bizState = $_POST['bizState'];
$bizZip = $_POST['bizZip'];
$fullName = $_POST['fullName'];
$bizEmail = $_POST['bizEmail'];
$productOne = $_POST['productOne'];
$productTwo = $_POST['productTwo'];
$productThree = $_POST['productThree'];
$moneyOff = '';
$totalPro = $productOne + $productTwo + $productThree;
define('PRODPRICE', 1100);
$totalMoney = $productOne * PRODPRICE
+ $productTwo * PRODPRICE
+ $productThree * PRODPRICE;
if ( $totalMoney == 2200 )
{
echo '<div class="alert alert-success">Go Back! You can get a product for free!</div>';
}
if ( $totalMoney == 3300 )
{
$moneyOff = 1100;
}
else
{
$moneyOff = 0;
}
define('STOCKFEE', 10);
$stockFee = $productOne * STOCKFEE
+ $productTwo * STOCKFEE
+ $productThree * STOCKFEE;
?>
<h1 align="center">Order Agreement</h1>
<br/>
<?php
echo '<strong>' .$bizName. '</strong> is purchasing the following products and services from CBE:</p>';
echo '<div class="well">
<table cellspacing="0" cellpadding="0" width="800px">
<thead>
<th>Qty</th>
<th>Product</th>
<th>Price</th>
</thead>
<tbody>
<tr>
<td align="center">'. $productOne .'</td>
<td align="center">Product One</td>
<td align="center">$1,100.00</td>
</tr>
<tr>
<td align="center">'. $productTwo .'</td>
<td align="center">Product Two</td>
<td align="center">$1,100.00</td>
</tr>
<tr>
<td align="center">'. $productThree .'</td>
<td align="center">Product Three</td>
<td align="center">$1,100.00</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right">Sub Total:</td>
<td align="center">'.number_format($totalMoney,2).'</td>
</tr>
<tr>
<td> </td>
<td align="right">Discount:</td>
<td align="center">'.number_format($moneyOff,2).'</td>
</tr>
<tr>
<td> </td>
<td align="right">Grand Total:</td>
<td align="center">'.number_format($totalMoney - $moneyOff,2).'</td>
</tr>
</tbody>
</table>
</div>';
echo '<p>Business agrees to pay <strong> '.number_format($totalMoney - $moneyOff,2).' </strong>for these products and services. In addition, Business will pay an additional <strong> '.number_format($stockFee,2).' </strong>to cover stock fee.</p>';
?>
<div class="row"> </div>
<div class="row">
<div align="left">
<table cellspacing="10" cellpadding="10" width="850px">
<tbody>
<tr><td> </td></tr>
<tr>
<td valign="top">
<?php
echo '<strong>' .$bizName. '</strong> <br/>';
echo $bizAddress.'<br/>';
echo $bizCity.', ';
echo $bizState.' ';
echo $bizZip.'';
?>
</td>
<td valign="top">
<strong>CBE</strong><br/>
Corporate Headquarters<br/>
555 Main Street<br/>
PHPLAND, DB 78987-3849<br/>
888-098-3049
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
include '_inc/footer.html';
?>
To store the the data across multiple forms:
<?php
session_start(); // Initiates the session, and loads the _SESSION variable
var_dump($_SESSION); // Show the data in the _SESSION variable
// Load data into the sessions
$_SESSION['a'] = 1;
$_SESSION['b'] = 'hello world';
if (!isset($_SESSION['c'])) $_SESSION['c'] = 0;
else $_SESSION['c'] += 2;
At first, you should see an empty array. Then, refresh and you will see your session data.
http://php.net/manual/en/features.sessions.php - for reference and further education...
Since you can easily access the data via $_POST array, to send all this information to the respective recipients use the mail() function of php to create an email and send it over to whoever you want.
When you submit the form to bizform.php, store you post variables in hidden input fields, and submit those to your form processor on step 3.
EDIT:
In other words, have your Confirm process post your hidden fields to another processor that creates your email content from the POST, and send TO the business, and yourself as a CC or BCC header.
<input name="AID" type="hidden" id="AID" value="<?php echo $_POST['AID']; ?>" size="32" />

Categories