I am creating invoice generator. In that I want to store the total,discount and all things in my database.
Total and discount are calculated as follow...
<tr ng-repeat="list in data">
<td>
<label class="clabel">Subtotal</label>
</td>
<td ng-model="subtotal">{{list.sale_price*list.quantity}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Tax(2%)</label>
</td>
<td ng-model="tax">{{((list.sale_price*list.quantity)*2)/100}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Discount(%)</label>
</td>
<td ng-model="discount">{{((list.sale_price*list.quantity)*list.discount)/100}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Total</label>
</td>
<td ng-model="total">{{((list.sale_price*list.quantity)+(((list.sale_price*list.quantity)*2)/100))-(((list.sale_price*list.quantity)*list.discount)/100)}}</td>
</tr>
<tr>
<td colspan="2">
<button class="btn btn-success" style="margin-left:400px;" ng-click="GenerateBill();updateAll()">Generate Invoice</button>
</td>
</tr>
Now I want to save the calculated values in my database.which means I want to store list.sale_price*list.quantity 's value.
js part is here..
$scope.updateAll = function(){
data={
qnt:$scope.qnt,
subt:$scope.subtotal,
tax:$scope.tax,
dis:$scope.discount,
total:$scope.total
}
$http.post("../POS_System/widget/updateAll.php?barcode="+$scope.barcode,data).success(function(data){
});
please help me out...
you can try this....
$scope.updateAll=function()
{
data={
subtotal:$scope.product.sale_prize*$scope.product.quantity,
tax:$scope.product.sale_prize * $scope.product.quantity*2/100,
discount:$scope.product.sale_prize * $scope.product.quantity*$scope.product.discount/100,
total:$scope.product.sale_prize * $scope.product.quantity+$scope.product.sale_prize * $scope.product.quantity*2/100-$scope.product.sale_prize *$scope.product.quantity* $scope.product.discount/100
}
$http.post("../pos_system/Widgets/updatedata.php?barc="+$scope.barc,data).success(function(data)
{
//do your stuff here;
});
}
Make this change in your HTML part
<tr >
<td>
<label class="clabel">Subtotal</label>
</td>
<td><input type="text" class="cinput" placeholder="sale price" ng-value="list.sale_price*list.quantity" readonly="" />
</td>
</tr>
<tr >
<td>
<label class="clabel">Tax(2%)</label>
</td>
<td><input type="text" class="cinput" placeholder="sale price" ng-value="((list.sale_price*list.quantity)*2)/100" readonly="" />
</td>
</tr>
<tr>
<td>
<label class="clabel">Discount(%)</label>
</td>
<td>
<input type="text" class="cinput" placeholder="sale price" ng-value="((list.sale_price*list.quantity)*list.discount)/100" readonly="" />
</td>
</tr>
<tr >
<td>
<label class="clabel">Total</label>
</td>
<td >
<input type="text" class="cinput" placeholder="sale price" ng-value="((list.sale_price*list.quantity)+(((list.sale_price*list.quantity)*2)/100))-(((list.sale_price*list.quantity)*list.discount)/100)" readonly="" />
</td>
</tr>
<tr>
<td colspan="2">
<button class="btn btn-success" style="margin-left:400px;" ng-click="GenerateBill();updateAll()">Generate Invoice</button>
</td>
</tr>
Related
I have a table, code as follow,
the table have select and checkbox, I try to wrap my table in a form and post to results.php to echo,
but when submit the form, it's not working. How to get the checkbox checked value from results.php?
<script>
var currentSelected = "";
var currentItem = "";
function show(obj, item) {
if (currentSelected != "" && currentSelected != obj) {
currentSelected.checked = false;
document.getElementById(currentItem).style.display = currentSelected.checked ? "block" : "none";
}
document.getElementById(item).style.display = obj.checked ? "block" :"none";
currentSelected = obj;
currentItem = item;
}
</script>
<form action="results.php" method="post">
<table width="805" border="0" >
<tr>
<td width="30"> </td>
<td width="30"> </td>
<td width="30"> </td>
<td width="30"> </td>
<td width="38"> </td>
<td width="25"> </td>
<td width="114"> </td>
<td width="456"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>Range</td>
<td> </td>
<td><p>
<input type="checkbox" name="absolute" onChange="change(this)" onclick="show(this,'s1');">
Absolute</p>
<p> </p>
<p>
<input type="checkbox" name="quick" onChange="change(this)" onclick="show(this,'s2');">
Quick</p></td>
<td><p>
<div id="s1" style="display:none">
<input class="date" id="datepicker" type="text" value="" name="from" placeholder="From" onFocus="this.value = '';" onBlur="if (this.value == '') {this.value = '';}" required=>
<input class="date" id="datepicker1" type="text" value="" name="to" placeholder="To" onFocus="this.value = '';" onBlur="if (this.value == '') {this.value = '';}" required=>
</div>
</p>
<p> </p>
<p>
<div id="s2" style="display:none">
<select name="quickselect" id="quickselect" >
<option value="30">Last 30 minutes</option>
<option value="60">Last 1 hour</option>
<option value="4h">Last 4 hour</option>
</select>
</div>
</p></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>Location</td>
<td> </td>
<td colspan="2">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>Index</td>
<td> </td>
<td colspan="2"><select name="loc" id="locselect" >
<option value="la">LA</option>
<option value="ny">NY</option>
<option value="all">CA & NY </option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>Keyword</td>
<td> </td>
<td colspan="2">
<input type="text" name="keyword" id="keyword" width="200">
</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td colspan="3"><div class="bnr-btn">
<input type="submit" value="Search">
</div></td>
</tr>
</table>
</form>
results.php
<?php
//how to echo the checkbox value ?????????
$quickselect= $_POST["quickselect"];
$locselect =$_POST["locselect "];
$keyword = $_POST["keyword "];
?>
To retreive a value from POST request using PHP you can use something like this
$checkbox = $_POST['absolute'];
The parameter name and the value is the same as on your html tag.
Eg:
<input name="absolute" type="checkbox" value="Your value" />
for checkbox :
$checkbox1=$_POST['absolute'];
$checkbox2=$_POST['quick'];
FOR get the date values
$from=$_POST['from'];
$to=$_POST['to'];
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'];
Here is my code to upload a Single Image. But i want to upload 3 images at a time.
How can i do it ?
<form enctype="multipart/form-data" action="process2.php" method="POST">
<table id="tbl1">
<tr>
<td>For Sale </td>
<td colspan="2">
<input type="hidden" name="id"/>
</td>
</tr>
<tr>
<td>Type: </td>
<td colspan="2">
<select name="type" id="slct"><option>Residential</option></select></td>
</tr>
<tr>
<td>State: </td><td colspan="2">
<select name="state" id="slct"><option>Punjab</option></select></td>
</tr>
<tr>
<td>City: </td><td colspan="2">
<select name="city" id="slct"><option>Lahore</option></select></td>
</tr>
<tr>
<td>Location: </td><td colspan="2">
<input name="location" placeholder="Enter Location Here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Bedrooms:</td><td colspan="2">
<select name="bedroom"><option>1</option></select></td>
</tr>
<tr>
<td>Land In: </td><td colspan="2">
<select name="landtype" id="slct"><option>Kanal</option></select>
</tr>
<tr>
<td>Land Area: </td><td colspan="2">
<input name="landarea" placeholder="Enter area here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Price: </td><td colspan="2">
<input name="price" placeholder="Enter price here" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Photo</td>
<td ><input type="file" name="photo" id="file"/></td>
</tr>
<tr>
<td>User Details</td>
<td colspan="2">
</td>
</tr>
<tr>
<td>Name: </td><td colspan="2">
<input name="name" placeholder="full name" id="slct2" type="text" /></td>
</tr>
<tr>
<td>Mobile: </td><td colspan="2">
<input name="mobile" placeholder="format 03001234567" id="slct2" type="text" /></td>
</tr>
<tr>
<td>E-mail: </td><td colspan="2">
<input name="email" placeholder="Enter email Here" id="slct2" type="text" /></td>
</tr>
<tr>
<td></td><td colspan="2"><input type="submit" name="submit" value="Post"/></td>
</tr>
</table>
</form>
add code in HTML
<td>Photo1</td><td ><input type="file" name="photo1" id="file1"/></td>
<td>Photo2</td><td ><input type="file" name="photo2" id="file2"/></td>
Add this code in your html and check selected images in your "process2.php" those are selected that store in your database.
When you insert this images in your database that time just do "img1,img2,img3" store this in your image colum... This is the simplest way if your requirement is only 3 images then you can follow this.
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}\" />";
I have this table of input fields that a user will fill out. As you can see, there's two pairs of fields, four columns across and and a minimum of five rows in length with the ability to dynamically add more rows as necessary. I've been struggling with how to name the input fields so that they can be grouped together correctly when the form is submitted. I've tried different variations of rows, etc. but none is working quite right. I would like for each pair to be in an array together, i.e.
[0] -> drum - value
[0] -> size - value
[1] -> drum - value
[1] -> size - value
Here's the table as I have it now. Thank you very much for your help, I really appreciate it!
<table id="drumInformation">
<tr>
<th colspan="9"><p>D R U M I N F O R M A T I O N – Drum Number(s) / Liter(s) or Gallon(s) Used</p>
<p> If some or all of your drum numbers fall in consecutive order, please feel free to use the
"series" method shown below to avoid typing each drum number individually and to save you valuable time.</p>
<p>Example:<br/>
10001, 10002, 10003, 10004, 10005, 10006 or 10001 - 10006</p>
</th>
</tr>
<tr class="labelRow">
<td class="label">
<label>Drum No.</label>
</td>
<td class="label">
<label><span class="euro">Liters</span><span class="domestic">Gallons</span></label>
</td>
<td class="label">
<label>Drum No.</label>
</td>
<td class="label">
<label><span class="euro">Liters</span><span class="domestic">Gallons</span></label>
</td>
<td class="label">
<label>Drum No.</label>
</td>
<td class="label">
<label><span class="euro">Liters</span><span class="domestic">Gallons</span></label>
</td>
<td class="label">
<label>Drum No.</label>
</td>
<td class="label">
<label><span class="euro">Liters</span><span class="domestic">Gallons</span></label>
</td>
</tr>
<tr>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td class="remove"></td>
</tr>
<tr>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td class="remove"></td>
</tr>
<tr>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td class="remove"></td>
</tr>
<tr>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td class="remove"></td>
</tr>
<tr>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td>
<input name="row[][drumNumber][]">
</td>
<td>
<input name="row[][gallons][]">
</td>
<td class="remove"><img src="/forms/assets/img/Plus-32.png" class="addRow"></td>
</tr>
</table>
I found a solution that works changing the table row to look like this:
<tr>
<td>
<input name="group[8][drumNumber]">
</td>
<td>
<input name="group[8][gallons]">
</td>
<td>
<input name="group[9][drumNumber]">
</td>
<td>
<input name="group[9][gallons]">
</td>
<td>
<input name="group[10][drumNumber]">
</td>
<td>
<input name="group[10][gallons]">
</td>
<td>
<input name="group[11][drumNumber]">
</td>
<td>
<input name="group[11][gallons]">
</td>
<td class="remove"></td>
</tr>
There might be a cleaner solution but this one works. I'm not sure why I was stuck with putting row[] whatever in the front.