Table Showing even in modal but the paragraph doesnt show - php

This is my code for my modal. im having a problem on my table because it is still showing. but when its only the paragraph tag, the words inside there are not showing. i already tried putting the table inside the p tag but still showing . what could i possibly do?
<!-- Modal for CONFIRM-->
<div class="modal fade" id="ModalConfirm<?php echo $id;?>" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body">
<p>Are you sure you want to confirm request?<?php echo $id?> </p>
<?php
$modalquery="select * from tbl_informant,tbl_missing_person,tbl_contact_person
where concat(reported_id=mp_id && mp_id=cp_id) && informant_id=".$id;
$modalresult=mysql_query($modalquery);
while ($row=mysql_fetch_array($modalresult)) {
?>
<form method="POST" action="">
<table border=1 width="120%" style="margin-left: 60px;">
<tr >
<td colspan="3" height="40px">
<center>
<b>INFORMANTS INFORMATION</b>
</center>
</td>
</tr>
<tr>
<td>
<b>Informants Name</b>
</td>
<td>
<?php echo $row['informant_fname'].' '.$row['informant_lname'];?>
</td>
</tr>
<tr>
<td>
<b>Address:</b>
</td>
<td colspan="2">
<?php echo $row['informants_address'];?>
</td>
</tr>
<tr>
<td>
<b>Contact</b>
</td>
<td >
<input type="number" name="informant_contact" placeholder="Enter Your Number"></input>
</td>
<td>
<input type="email" name="informant_email" placeholder="Enter Your Email"></input>
</td>
</tr>
</table><br><br>
<table border=1 width="120%" style="margin-left: 60px;">
<tr>
<td colspan="3" height="40px" >
<center>
<b>SIGHTING INFORMATION</b>
</center>
</td>
</tr>
<tr>
<td>
<b>Upper Apparel</b>
</td>
<td>
<?php echo$row['si_upper'];?>
</td>
<td>
<b>Lower Apparel</b>
</td>
<td>
<?php echo$row['si_lower'];?>
</td>
</tr>
<tr>
<td >
<b>Last Location Seen:</b>
</td>
<td colspan="2">
<center>
<textarea cols="40" rows="3" placeholder="Enter the Last Location You've seen him/her" name="si_location"></textarea>
</center>
</td>
</tr>
<tr>
<td>
<b>
Childs Last Action/ Doing
</b>
</td>
<td colspan="2">
<center>
<textarea cols="40" rows="3" placeholder="Enter The Childs Last Activity" name="si_activity"></textarea>
</center>
</td>
</tr>
<tr>
<td colspan="3" height="50px">
<center>
<input type="submit" name="btnSubmit" value="SUBMIT"></input>
</center>
</td>
</tr>
</table><br><br><br>
</form>
<?php
}
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" >Yes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div>
</div>
this is all of the code that my confirm button should have but when it has tables the yes or no button also shows outside the modal.

Related

Maximum number of Modals in Bootstrap PHP

Does Bootstrap has a maximum number of Modals allowed per page?
I have a total of 3 modals that will be used on the page.
1 is an modal-sm which will be used for Admin Login.
1 modal-lg which will be used as an Asset Add window.
and 1 modal-lg which will be used as an Asset Edit window
The Admin Login and Asset Addition window works. But when I try to open the Asset Edit window, the modal doesn't show up but the backdrop goes dark.
When I delete the Admin Login modal and the Asset addition window's code, the Asset Edit window works.
Please take note that as of the moment, Asset Addition and Asset Edit windows have exactly the same code. The Asset Addition works but the Asset Edit does not.
This just bugs me so hard. I'll really appreciate your assistance.
Admin Window:
<div class="modal fade" id="adminModal" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div style="padding-top:20px;">
<center>
<img src="TISAMI2.png" style="height:100px;">
<br><br>
<h4 class="modal-title" style="font-family:'Encode Sans Expanded'; font-weight:600;">Admin Login</h4>
<div class="modal-body">
<br>
<form action=adminlogin.php method=POST>
<p><span style="font-family:'Encode Sans Expanded';">Username</span>
<br><input type=text name="username">
</p>
<p><span style="font-family:'Encode Sans Expanded';">Password</span>
<br><input type=password name="password">
<p>
<br>
</center>
</div>
<div class="modal-footer">
<input type=submit class="btn btn-Success" value=Sign-In>
</form>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Asset Add Window:
<div class="modal fade" id="addDLModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div style="padding-top:20px; padding-right:20px; padding-left:20px; min-width:800px;">
<center>
<img src="TISAMI2.png" style="height:100px;">
<BR><BR>
<h4 class="modal-title" style="font-family:'Encode Sans Expanded'; font-weight:600;">Desktop and Laptop Asset Information</h4>
</center>
<div class="modal-body">
<br>
<form>
<p><span style="font-family:'Encode Sans Expanded';">Status:</span>
<select class=dlStatus id=dlStatus disabled>
<option>IN STOCK
<option>IN USE
</select>
<p><span style="font-family:'Encode Sans Expanded';">Asset Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>Unit Type:
<td width=20%><input type=text class=dlType id=dlType disabled>
<!-- <td width=20%><div class=dlType id=dlType> -->
<td width=20%>Computer Name:
<td width=20%><input type=text class=dlCName id=dlCName disabled>
</tr>
<tr>
<td>Brand:
<td><input type=text class=dlBrand id=dlBrand disabled>
<td>Model:
<td><input type=text class=dlModel id=dlModel disabled>
</tr>
<tr>
<td>Asset Tag:
<td><input type=text class=dlAssetTag id=dlAssetTag disabled>
<td>Remarks:
<td><input type=text class=dlPlus id=dlPlus disabled>
</tr>
<tr>
<td>Serial No.:
<td><input type=text class=dlSerialNo id=dlSerialNo disabled>
<td>Overall Condition:
<td><input type=text class=dlOACondition id=dlOACondition>
</tr>
<tr>
<td>MAC Address:
<td><input type=text class=dlMAC id=dlMAC disabled>
<td>Useable:
<td><input type=text class=dlUse id=dlUse>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">User Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>IGG:
<td width=20%><input type=text class=dlIGG id=dlIGG>
<td width=20%>Full Name:
<td width=20%><input type=text class=dlFullName id=dlFullName>
</tr>
<tr>
<td>Department:
<td><input type=text class=dlDepartment id=dlDepartment>
<td>Office:
<td><input type=text class=dlOffice id=dlOffice>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">Accessories Details</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=16%>Keyboard:
<td width=16%><input type=checkbox class=dlKeyboard id=dlKeyboard>
<td width=16%>Mouse:
<td width=16%><input type=checkbox class=dlMouse id=dlMouse>
<td width=16%>Charger:
<td width=16%><input type=checkbox class=dlCharger id=dlCharger>
</tr>
<tr>
<td>Bag:
<td><input type=checkbox class=dlBag id=dlBag>
<td>Docking Station:
<td><input type=checkbox class=dlDockingStation id=dlDockingStation>
<td>UPS:
<td><input type=checkbox class=dlUPS id=dlUPS>
</tr>
<tr>
<td>Monitor 1:
<td><input type=checkbox class=dlMonitor1 id=dlMonitor1>
<td>Monitor 2:
<td><input type=checkbox class=dlMonitor2 id=dlMonitor2>
<td>
<td>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">Previous Owner Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>Employee Number:
<td width=20%><input type=text class=dlPrevIGG id=dlPrevIGG>
<td width=20%>Full Name:
<td width=20%><input type=text class=dlPrevName id=dlPrevName>
</tr>
</table>
</form>
<br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Asset Edit Window:
<div class="modal fade" id="editDLModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div style="padding-top:20px; padding-right:20px; padding-left:20px; min-width:800px;">
<center>
<img src="TISAMI2.png" style="height:100px;">
<BR><BR>
<h4 class="modal-title" style="font-family:'Encode Sans Expanded'; font-weight:600;">Desktop and Laptop Asset Information</h4>
</center>
<div class="modal-body">
<br>
<form>
<p><span style="font-family:'Encode Sans Expanded';">Status:</span>
<select class=dlStatus id=dlStatus disabled>
<option>IN STOCK
<option>IN USE
</select>
<p><span style="font-family:'Encode Sans Expanded';">Asset Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>Unit Type:
<td width=20%><input type=text class=dlType id=dlType disabled>
<!-- <td width=20%><div class=dlType id=dlType> -->
<td width=20%>Computer Name:
<td width=20%><input type=text class=dlCName id=dlCName disabled>
</tr>
<tr>
<td>Brand:
<td><input type=text class=dlBrand id=dlBrand disabled>
<td>Model:
<td><input type=text class=dlModel id=dlModel disabled>
</tr>
<tr>
<td>Asset Tag:
<td><input type=text class=dlAssetTag id=dlAssetTag disabled>
<td>Remarks:
<td><input type=text class=dlPlus id=dlPlus disabled>
</tr>
<tr>
<td>Serial No.:
<td><input type=text class=dlSerialNo id=dlSerialNo disabled>
<td>Overall Condition:
<td><input type=text class=dlOACondition id=dlOACondition>
</tr>
<tr>
<td>MAC Address:
<td><input type=text class=dlMAC id=dlMAC disabled>
<td>Useable:
<td><input type=text class=dlUse id=dlUse>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">User Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>IGG:
<td width=20%><input type=text class=dlIGG id=dlIGG>
<td width=20%>Full Name:
<td width=20%><input type=text class=dlFullName id=dlFullName>
</tr>
<tr>
<td>Department:
<td><input type=text class=dlDepartment id=dlDepartment>
<td>Office:
<td><input type=text class=dlOffice id=dlOffice>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">Accessories Details</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=16%>Keyboard:
<td width=16%><input type=checkbox class=dlKeyboard id=dlKeyboard>
<td width=16%>Mouse:
<td width=16%><input type=checkbox class=dlMouse id=dlMouse>
<td width=16%>Charger:
<td width=16%><input type=checkbox class=dlCharger id=dlCharger>
</tr>
<tr>
<td>Bag:
<td><input type=checkbox class=dlBag id=dlBag>
<td>Docking Station:
<td><input type=checkbox class=dlDockingStation id=dlDockingStation>
<td>UPS:
<td><input type=checkbox class=dlUPS id=dlUPS>
</tr>
<tr>
<td>Monitor 1:
<td><input type=checkbox class=dlMonitor1 id=dlMonitor1>
<td>Monitor 2:
<td><input type=checkbox class=dlMonitor2 id=dlMonitor2>
<td>
<td>
</tr>
</table>
<p><span style="font-family:'Encode Sans Expanded';">Previous Owner Information</span>
<table style="width:100%; margin-left:20px;">
<tr>
<td width=20%>Employee Number:
<td width=20%><input type=text class=dlPrevIGG id=dlPrevIGG>
<td width=20%>Full Name:
<td width=20%><input type=text class=dlPrevName id=dlPrevName>
</tr>
</table>
</form>
<br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
This just bugs me so hard. I'll really appreciate your assistance.
EDITED
There is no limit for Bootstrap Modals in one page.
Check whether your modals have similar ID or name.
Issue can be within the transitions. Please refer the
link: https://getbootstrap.com/docs/4.2/components/modal/#methods
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.

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.

Combining a variable with html and inserting an output from a echo statment

I have a loan calculator plugin that has the below code block. It sets the variable $calcHTML and then returns it to publish it to the screen. It looks like a lot of code but it is really just putting a bunch of html to a variable then returning it.
I want to place my social button from another plugin in the middle of $calcHTML, so that my social button output on the calculator.
The code to output my social buttons is:
Social plugin code
if ( function_exists( 'rtsocial' ) ) { echo rtsocial(); }
How can I use the above function and combine it so that the output will be placed in the $calcHTML variable below?
Calculator code below
add_shortcode('clc_car_loan_calculator', 'clc_car_loan_calculator');
function clc_car_loan_calculator($atts) {
$queryString = '';
if(isset($atts['currency'])) {empty($queryString)?$queryString .= '?':$queryString .= '&'; $queryString .= 'currency='.urlencode($atts['currency']);}
if(isset($atts['theme'])) {empty($queryString)?$queryString .= '?':$queryString .= '&'; $queryString .= 'theme='.urlencode($atts['theme']);}
$calcHTML = '<div class="clc-widget clc-fp-widget">
<form>
<table class="clc-input-table">
<tr>
<td>Vehicle Price</td>
<td>
<input type="text" id="clc-fp-car-loan-price" />
</td>
<td>Down Payment</td>
<td>
<input type="text" id="clc-fp-car-loan-down-payment" />
</td>
</tr>
<tr>
<td>Trade in Amount</td>
<td>
<input type="text" id="clc-fp-car-loan-trade" />
</td>
<td>Owed on Trade</td>
<td>
<input type="text" id="clc-fp-car-loan-trade-owed" />
</td>
</tr>
<tr>
<td>Interest Rate</td>
<td>
<input type="text" id="clc-fp-car-loan-interest-rate" />
</td>
<td>Sales Tax Rate</td>
<td>
<input type="text" id="clc-fp-car-loan-tax-rate" />
</td>
</tr>
<tr>
<td>Term (months)</td>
<td>
<input type="text" id="clc-fp-car-loan-term" />
</td>
<td>Start Date</td>
<td>
<input type="text" id="clc-fp-car-loan-start-date" />
</td>
</tr>
<tr>
<td colspan="4">
<input type="submit" id="clc-fp-calculate-car-loan-button" value="Calculate" onClick="return false;" />
</td>
</tr>
</table>
</form>
<table class="clc-fp-display-table">
<tr>
<td>
<h2>Loan Summary</h2>
<div id="clcFPCarLoanBreakdownData"></div>
<div class="clc-clear-line" style="height:20px;"></div>
<table class="clc-full-width">
<tr>
<td class="clc-breakdown-cell">
<div id="clcFPCarLoanBreakdownChart" style="width:180px; height:180px;"></div>
</td>
<td class="clc-balances-cell">
<div id="clcCarLoanPrincipleHeading" class="clc-heading"></div>
<div id="clcCarLoanPrincipleChart" style="width:100%; height:180px;"></div>
</td>
</tr>
</table>
<div class="clc-clear-line" style="height:30px;"></div>
<div id="clcFPCarLoanAmortizationData">
<ul>
<li>
Yearly Amortization
</li>
<li>
Monthly Amortization
</li>
<li>
Detailed Summary
</li>
</ul>
<div id="clcFPCarLoanLoanDetails"></div>
<div id="clcFPCarLoanYearlyAmortization"></div>
<div id="clcFPCarLoanMonthlyAmortization"></div>
<div class="clc-clear-line"></div>
</div>
</td>
</tr>
</table>
<script src="'.plugins_url('/js/bootstrap-fp.js'.$queryString, __FILE__).'" id="clc-fp-car-loan" type="text/javascript"></script>
</div>';
return $calcHTML;
}
if ( function_exists( 'rtsocial' ) ) { $calcvalue = rtsocial(); }
And in your function
function clc_car_loan_calculator($atts) {
global $calcvalue;
..
....
......
return $calcHTML.''.$calcvalue;
}
You need to read about String Operators
If you want to place some content in the middle you need to do it as follows
if ( function_exists( 'rtsocial' ) ) {
$calcHTML .= rtsocial();
}
the . operaor is used for the concatination. Your whole function will now look like this
<?php
function clc_car_loan_calculator($atts) {
$queryString = '';
if(isset($atts['currency'])) {empty($queryString)?$queryString .= '?':$queryString .= '&'; $queryString .= 'currency='.urlencode($atts['currency']);}
if(isset($atts['theme'])) {empty($queryString)?$queryString .= '?':$queryString .= '&'; $queryString .= 'theme='.urlencode($atts['theme']);}
$calcHTML = '<div class="clc-widget clc-fp-widget">
<form>
<table class="clc-input-table">
<tr>
<td>Vehicle Price</td>
<td>
<input type="text" id="clc-fp-car-loan-price" />
</td>
<td>Down Payment</td>
<td>
<input type="text" id="clc-fp-car-loan-down-payment" />
</td>
</tr>
<tr>
<td>Trade in Amount</td>
<td>
<input type="text" id="clc-fp-car-loan-trade" />
</td>
<td>Owed on Trade</td>
<td>
<input type="text" id="clc-fp-car-loan-trade-owed" />
</td>
</tr>
<tr>
<td>Interest Rate</td>
<td>
<input type="text" id="clc-fp-car-loan-interest-rate" />
</td>
<td>Sales Tax Rate</td>
<td>
<input type="text" id="clc-fp-car-loan-tax-rate" />
</td>
</tr>
<tr>
<td>Term (months)</td>
<td>
<input type="text" id="clc-fp-car-loan-term" />
</td>
<td>Start Date</td>
<td>
<input type="text" id="clc-fp-car-loan-start-date" />
</td>
</tr>
<tr>
<td colspan="4">
<input type="submit" id="clc-fp-calculate-car-loan-button" value="Calculate" onClick="return false;" />
</td>
</tr>
</table>
</form>';
if ( function_exists( 'rtsocial' ) ) {
$calcHTML .= rtsocial();
}
$calcHTML .= '<table class="clc-fp-display-table">
<tr>
<td>
<h2>Loan Summary</h2>
<div id="clcFPCarLoanBreakdownData"></div>
<div class="clc-clear-line" style="height:20px;"></div>
<table class="clc-full-width">
<tr>
<td class="clc-breakdown-cell">
<div id="clcFPCarLoanBreakdownChart" style="width:180px; height:180px;"></div>
</td>
<td class="clc-balances-cell">
<div id="clcCarLoanPrincipleHeading" class="clc-heading"></div>
<div id="clcCarLoanPrincipleChart" style="width:100%; height:180px;"></div>
</td>
</tr>
</table>
<div class="clc-clear-line" style="height:30px;"></div>
<div id="clcFPCarLoanAmortizationData">
<ul>
<li>
Yearly Amortization
</li>
<li>
Monthly Amortization
</li>
<li>
Detailed Summary
</li>
</ul>
<div id="clcFPCarLoanLoanDetails"></div>
<div id="clcFPCarLoanYearlyAmortization"></div>
<div id="clcFPCarLoanMonthlyAmortization"></div>
<div class="clc-clear-line"></div>
</div>
</td>
</tr>
</table>
<script src="'.plugins_url('/js/bootstrap-fp.js'.$queryString, __FILE__).'" id="clc-fp-car-loan" type="text/javascript"></script>
</div>';
return $calcHTML;
}
?>

PHP: Two buttons to submit

I've been trying to submit two buttons, one to delete and one to edit/add. But I can't seem to get it right.
HTML:
<!-- Edit/Delete Account Form -->
<form method="get" action="edit.php" onsubmit="setTimeout('location.reload()');">
<div id="edit-form" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h4><?php _e('Edit/Delete Account'); ?></h4>
</div>
<div class="modal-body">
<div id="message"></div>
<div class="control">
<div id="edit-account-form">
<table id="add-account" class="table">
<tbody>
<tr>
<td valign="middle">
Account Number
</td>
<td>
<input type="hidden" id="editid" name="editid" value=""/>
<input type="text" id="number" name="number" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Account Description
</td>
<td>
<input type="text" id="description" name="description" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Level 01
</td>
<td>
<input type="text" id="level01" name="level01" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Level 02
</td>
<td>
<input type="text" id="level02" name="level02" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Level 03
</td>
<td>
<input type="text" id="level03" name="level03" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Level 04
</td>
<td>
<input type="text" id="level04" name="level04" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Tax
</td>
<td>
<input type="text" name="account" value="Enter Some text here "/>
</td>
</tr>
<tr>
<td>
Allow General Journals
</td>
<td>
<select>
<option selected disabled>Select</option>
<option>Yes</option>
<option>No</option>
</select>
</td>
</tr>
<tr>
<td>
Allow Payments
</td>
<td>
<select>Select</select>
</td>
</tr>
<tr>
<td>
Allow Expense Claims
</td>
<td>
<select>Select</select>
</td>
</tr>
<tr>
<td>
Show On Dashboard
</td>
<td>
<select>Select</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" data-complete-text="<?php _e('Done'); ?>" name="add" class="btn btn-primary pull-right"><?php _e('Submit'); ?></button>
<p class="pull-left"><button type="submit" name="delete" class="btn btn-primary pull-right"><?php _e('Delete'); ?></button></p>
</div>
</div>
</form>
PHP:
<?php
//Account Details
$number = $_GET['number'];
$description = $_GET['description'];
$level01 = $_GET['level01'];
$level02 = $_GET['level02'];
$level03 = $_GET['level03'];
$level04 = $_GET['level04'];
$id = $_GET['editid'];
$dbc = mysqli_connect('localhost', 'root', 'root', 'accounting') or die('Connection error!');
if(isset($_POST['delete'])) {
$check = "DELETE FROM accountSlave WHERE `id` = '$id' ";
mysqli_query($dbc, $check) or die('Database error, delete account!');
}
if(isset($_POST['add'])) {
//$check = "DELETE FROM accountSlave WHERE `id` = '$id' ";
$check = "UPDATE accountSlave SET `accountNumber` = '$number', `accountDescription` = '$description', `accountLevel1` = '$level01', `accountLevel2` = '$level02', `accountLevel3` = '$level03', `accountLevel4` = '$level04' WHERE `id` = '$id'";
mysqli_query($dbc, $check) or die('Database error, add account!');
}
header('location:master-accounts.php');
?>
It works when I have one query. I've tried one query to add and to delete and it worked. But I need to submit a delete if delete button clicked and vice versa.
I followed this post to try get it right multiple buttons on a form
Any help or suggestions will be appreciated!
You need to use $_GET instead of $_POST. It should be like
if(isset($_GET['delete'])) {
and
if(isset($_GET['add'])) {
Because your form submit method is GET not the POST
You have to check which button is pressed and according to that do your operation.
Also you have to use $_GET not $_POST because your form method is GET.
if(isset($_GET['add'])) {
// code for add
} elseif(isset($_GET['delete'])) {
// code for delete
}

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