As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i need to show the download file option once the user fills the below email and name form -- Here is the form
<form action="process.php" method="post">
<input type="hidden" name="bot_action" value="form_subscribe" /> <input
type="hidden" name="bot_track_code" value="1" /> <input type="hidden"
name="bot_pass_standard" value="0" /> <input type="hidden"
name="bot_pass_custom" value="0" /> <input type="hidden"
name="bot_account" value="howtopossibleit" /> <input type="hidden"
name="bot_redirect" value="" /> <input type="hidden"
name="bot_web_form_id" value="44640" />
<table width="230" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="10" width="10%" align="left" valign="middle"></td>
<td height="10" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 0px 0px 0px;">
<div align="center">Name:</div>
</div></td>
<td height="10" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 1px 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="fullname" value="" /></td>
</tr>
<tr>
<td height="31" width="10%" align="left" valign="middle"></td>
<td height="15" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 5px 0px 0px;">
<div align="center">Email:</div>
</div></td>
<td height="15" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 21x 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="email" value="" /></td>
</tr>
<tr>
<td height="15" colspan="3" align="center" valign="middle"><table
style="border: 1px solid #363636;" cellpadding="0" cellspacing="0">
<tr style="background-color: #e8e8e8; color: #FFFFFF;">
<td width="234" height="26" align="center" bgcolor="#FF0000"
style="border-top: 1px solid #ffffff; border-left: 1px solid #ffffff;"><input
type="submit"
style="overflow: auto !important; overflow: visible; width: auto !important; width: 55px; margin: 0px 15px 0px 15px; border: 0px; background-color: #FF0000; font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636;"
name="submit2" value="SUBMIT, Than press Download" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="4" colspan="3" valign="middle"
style="padding: 3px 0px 3px 0px;"></td>
</tr>
</table>
</form>
Here is the download file code:
DownloadFile: <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download">
Set the code in a div and make it display:none initially..
<div id="link" style="display:none"> <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download"></div>
call this jquery function in onblur event of both name & email field
function enableLink() {
if($("#name").val() != "" && $("#email").val() != "")
$("#link").show();
else
$("#link").hide();
}
Related
I am trying to run a php file using xampp but I'm getting the Object not found error, I watched some videos where people say create another folder and run it under that but that is not working for me! look at the screenshot below and please if you could help me understand why this isn't working
enter image description here
Please note even if i use another file such as footer.php i get the same error.
here is the code for mens.php i didnt include it in the screenshot
<?php
session_start();
//unset($_SESSION['basket']);
?>
<!DOCTYPE html>
<html>
<head>
<!-- External Stylesheet -->
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Mens</title>
</head>
<body>
<div class="bar">Sale Now On!</div>
<div id="outer">
<?php
include('header.php');
?>
<!-- All content will be wrapped insisde this container -->
<div id="container">
<!-- Page -->
<h2>Mens Clothing</h2>
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="headings">
<th style="width: 20%;">Photo</th>
<th style="width: 30%;">Desciption</th>
<th style="width: 10%;">Size</th>
<th style="width: 10%;">Price</th>
<th style="width: 10%;">Qty</th>
<th style="width: 20%;">Action</th>
</tr>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Contempary Hugo Boss
Suit</td>
<input type="hidden" name="itemdesc" value="Contempary Hugo Boss
Suit" />
<input type="hidden" name="sku" value="100" />
<input type="hidden" name="pic" value="suit.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£500.00</td>
<input type="hidden" name="price" value="500.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit1.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Wool Hugo Boss Suit</td>
<input type="hidden" name="itemdesc" value="Wool Hugo Boss Suit"
/>
<input type="hidden" name="sku" value="101" />
<input type="hidden" name="pic" value="suit1.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£450.00</td>
<input type="hidden" name="price" value="450.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
</table>
</div>
</div>
<?php
include('footer.php');
?>
</body>
</html>
A file called ._mens.php Is NOT the same as a file called mens.php
As you are using the url localhost/example/mens.php then the file needs to be called mens.php
This question already has answers here:
Warning: preg_replace(): Unknown modifier
(3 answers)
Closed 5 years ago.
So i want to extract everything in between form tags (including the tags them selves).
The form is as below:
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
Regex i am using is: <form.*>[\s\S]*<\/form> and according to regex101 This is a valid regular expression that should extract form tags + everthing in between.
However using the above regular expression in preg_match i get the following error: Warning: preg_match(): Unknown modifier '['
Not sure what you actual issue is. For me your pattern works like charm:
<?php
$markup = <<<HTML
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
HTML;
preg_match('~<form.*>([\s\S]*)</form>~', $markup, $tokens);
var_dump($tokens[1]);
The output of that is:
string(829) "
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
"
The only modification I made is to add the capture group ((...)) to be able to actually extract something.
You are escaping the forward slash in the closing </form> tag with a back slash. Most likely that is because online regex tools like regex101 use forward slashes as standard delimiters in their patterns. Note that you can use other characters which makes the pattern easier to read, since you do not have to escape characters then...
I suspect that you maybe forgot to place your pattern in between delimiters?
DOMPDF creating blank page at the start of document in laravel. I have chacked all html cotent there is no spaces. anybody has suggestion?
Below is code which I am trying to fit into a pdf file using DOMPDF
<div class="invoice printableArea" style="color: #333333; font: 12px Verdana; padding: 0; margin: 0;">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main-table"
style="height: 100%;margin-top: 0;">
<tr>
<td align="center" style="width: 100%; height: 100%;">
<table cellpadding="0" cellspacing="0" border="0"
style=" width: 100%; table-layout: fixed; margin: 0px;">
<tr>
<td style=" border: 1px solid #e6e6e6; margin: 0px auto 0px auto; padding: 20px; text-align: left;">
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin:0;">
<tr>
<td style="padding:0px 0px 0px 0px;">
<img src="" width="150" height="45" alt=""/></td>
</tr>
</table>
<table cellpadding="0" cellspacing="5" border="0" width="100%" style="border: 1px solid #e6e6e6; padding:0;margin-top:10px;">
<tr valign="top">
<td style="padding: 15px;">
<h2 style="margin: 0px 0px 10px 0px;">Invoice #</h2>
<table style="float:left;border:none;margin:0;" >
<tbody>
<tr>
<td style="padding: 5px;text-align: right;">Invoice Date : </td>
<td style="padding: 5px;text-align: right;"> </td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Payment Method : </span></td>
<td style="padding: 5px;text-align: right;"></td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Shipping Method : </span></td>
<td style="padding: 5px;text-align: right;"></td>
</tr>
</tbody>
</table>
</td>
<td style="padding: 30px 0px 0px 0px;text-align: center;">
<div id="invoiceBarcodeTarget"></div>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="5" border="0" width="100%"
style="padding:20px 0px;">
<tr valign="top">
<td width="34%"
style="padding:10px;">
<h3 style=" padding: 0px 0px 3px 1px; margin: 0px;">Billing Address : </h3>
<p style="margin: 2px 0px 3px 0px;">
<strong></strong> </p>
<p style="margin: 2px 0px 3px 0px;">
<br/></p>
<p style="margin: 2px 0px 3px 0px;">
</p>
<p style="margin: 2px 0px 3px 0px;">
</p>
<p style="margin: 2px 0px 3px 0px;">
<i title="Phone" class="fa fa-phone-square"></i>
<br/>
<i title="Phone" class="fa fa-phone-square"></i>
#endif
</p>
</td>
<td width="33%" style="padding:10px;">
<h3 style=" padding: 0px 0px 3px 1px; margin: 0px;">Shipping Address : </h3>
<p style="margin: 2px 0px 3px 0px;">
<strong></strong> </p>
<p style="margin: 2px 0px 3px 0px;">
<br/></p>
<p style="margin: 2px 0px 3px 0px;">
</p>
<p style="margin: 2px 0px 3px 0px;">
</p>
<p style="margin: 2px 0px 3px 0px;">
<i title="Phone" class="fa fa-phone-square"></i>
</p>
#endif
</td>
</tr>
</table>
<table class="" style="background-color: #dddddd;border: 1px solid #e6e6e6;margin:0;">
<tr>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; "><strong class="text-center">Sr. No.</strong></th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Product
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Unit price
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Discount
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Quantity
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Subtotal
</th>
</tr>
<tbody>
<tr>
<td style="padding: 5px 10px; background-color: #ffffff;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6;text-align: center; ">{{$i}}</td>
<td style="padding: 5px 10px; background-color: #ffffff;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6;text-align: left; ">
<b>{{#$product_detail['title']}} </b> <br />
<b>Seller : </b> {{#$product_detail['store_name']}}
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: center;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span>{{ number_format(#$product['price'], 2) }}</span>
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: center;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span>0.00</span>
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: right;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
{{#$product['quantity']}}
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: right;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span>{{ number_format(#$product['price']*$product['quantity'], 2) }}</span>
</td>
</tr> </tbody>
</table>
<table class="" style="background-color: #dddddd;border: 1px solid #e6e6e6;margin:0;">
<tr>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; "><strong class="text-center">Sr. No.</strong></th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Product
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Unit price
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Discount
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Quantity
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Delivery Address
</th>
<th style="background-color: #f9f9f9; padding: 6px 10px; white-space: nowrap;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
Subtotal
</th>
</tr>
<tbody><tr>
<td style="padding: 5px 10px; background-color: #ffffff;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6;text-align: center; ">{{$i}}</td>
<td style="padding: 5px 10px; background-color: #ffffff;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6;text-align: left; ">
<b>{{#$product_detail['title']}} </b> <br />
<b>Seller : </b> {{#$product_detail['store_name']}}
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: center;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span></span>
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: center;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span>0.00</span>
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: right;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
1
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: right;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span style="text-align:left;float:left;">
</span>
</td>
<td style="padding: 5px 10px; background-color: #ffffff; text-align: right;border-right: 1px solid #e6e6e6;border-top: 1px solid #e6e6e6; ">
<span><span class="WebRupee">₹</span>{{ number_format(#$product['price'], 2) }}</span>
</td>
</tr>
<?php $i++; ?>
#endforeach
#else
<tr>
<td colspan="100%">
{{trans('messages.error.order.order_product.empty')}}
</td>
</tr>
#endif
</tbody>
</table>
#endif
<table style="width:35%;float:right;border:none;" >
<tbody>
<tr>
<td style="padding: 5px;text-align: right;">Subtotal : </td>
<td style="font-weight: bold;padding: 5px;text-align: right;"><span><span class="WebRupee">₹</span>{{ number_format(#$invoiceData['invoice']['subtotal'], 2) }}</span></td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Order Discount (-) : </span></td>
<td style="font-weight: bold;padding: 5px;text-align: right;"><span><span class="WebRupee">₹</span>00.00</span></td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Price After Discount : </span></td>
<td style="font-weight: bold;padding: 5px;text-align: right;"><span><span class="WebRupee">₹</span>{{ number_format(#$invoiceData['invoice']['total'], 2) }}</span></td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Shipping Cost : </span></td>
<td style="font-weight: bold;padding: 5px;text-align: right;"><span><span class="WebRupee">₹</span>{{ number_format(#$invoiceData['invoice']['shipping_cost'], 2) }}</span></td>
</tr>
<tr>
<td style="padding: 5px;text-align: right;"><span>Grand Total : </span></td>
<td style="font-weight: bold;padding: 5px;text-align: right;"><span><span class="WebRupee">₹</span>{{ number_format(#$invoiceData['invoice']['total'], 2) }}</span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Three things:
1) Nested tables. Generally fine, but your outer table is just a container for the inner table. dompdf is currently unable to break an individual table cell across pages (#98) so this will cause you all kinds of grief. If you have styling on that table that you want to apply (e.g. a border) use a div instead.
2) The height: 100%; styling. Avoid this if you can on elements that are the direct child of the body. dompdf's height calculation can sometimes be off by a bit, causing paging on an element with 100% of the body height.
3) The height: 100%; styling, part 2. The height probably won't be what you expect since dompdf (and by default web browsers) determine height by the content area not the containing box. Margin and padding will further expand the element's height unless everything is specifically set to 0. At least until dompdf supports the box-sizing declaration.
I have html variable,i want to send it as attachment via email.
here is my code
$html='
<table cellpadding="0" cellspacing="0" style=" margin:0 auto;" width="100%">
<tr>
<th style="background:#FC3; padding:4px 0;border:1px solid #000; border-bottom:2px solid #000; border-right:2px solid #000;" align="center" valign="middle"><h3 style="font:300 14px verdana; margin:0; text-align:left;text-align:center;">DECLARATION BY THE AGENT</h3></th>
<th style="background:#FC3; padding:4px 0;border:1px solid #000; border-bottom:2px solid #000; border-right:2px solid #000;" align="center" valign="middle"><h3 style="font:300 14px verdana; margin:0; text-align:left;text-align:center;">DECLARATION BY THE OWNER (The Seller)</h3></th>
</tr>
<tr>
<td width="49%" style="padding:5px 10px;border-right:2px solid #000;">
<ul style="margin:0; padding:0;">
<li style="list-style:none; margin:0 0 10px 0;">
<p style="font:300 12px verdana;float: left; margin:0 5px 0 0;text-align:center;">
I hereby declare, I have read and understood the Real Estate Brokers Code of Ethics,
</p>
</li>
</ul></td>
<td width="49%" style="padding:5px 10px;border-left:1px solid #000;">
<ul style="margin:0; padding:0;">
<li style="list-style:none; margin:0 0 10px 0;">
<p style="font:300 12px verdana;float: left; margin:0 5px 0 0; text-align:center;">
I/We hereby declare, we are the Owners of the property as stated below.
</p>
</li>
</ul></td>
</tr>
</table>';
$mail->AddAttachment($html); // attachment
$mail->Send();
AddAttachment() requires a file (on the filesystem)
there is the AddStringAttachment() function for what you are doing. see docs: http://docs.redaxo.com/de/4.3.1/class_p_h_p_mailer.html#a92ef5134fdce5bd5fd24a723c508bf2b
try this:
$mail->AddStringAttachment($html,"filename.htm","base64","text/html");
I think you are trying to send html instead so try like this
$mail->Body = $html;
$mail->Send();
ok, so you are trying to send it for example and it deosn't work ?
$mail->AddAttachment("/var/tmp/file.html");
I'm trying to update different rows from mysql that they filtered by some record . in this code first the user should enter two input : classnumber and level .
records that they have this fields will show in table then the user should be able to update this records information . but the problem is all of records are in one table in mysql so their id is different I mean for example the first record that match with two inputs id is 2 and then the next one is 5 and next one 6 and ....
with this kind of situation how should I change the code below ?
<form id="searchform" method="post" dir="rtl" action="">
level :<input name="level" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="level" />
classnumber :<input name="classnum" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="classnum" />
<input style="margin-top:10px; margin-left:120px; font-size: 14px; padding: 5px 14px;" type="submit" value="جستجو" name="enter" />
</form>
<?php
if(isset($_POST['enter'])){
$sql="SELECT * FROM `".$tbl_name."` where classnum='".$_REQUEST['classnum']."' and level='".$_REQUEST['level']."' ";
$result=mysql_query($sql,$link);
$count=mysql_num_rows($result);
}
?>
<div class="cleaner h30"></div>
<br>
<form name="form1" action="" method="POST">
<center>
<div>
<div align="center" width = 615>
<table class="stats" cellspacing="0" width="615" border="1">
<tr>
<th width="20" scope="col" >Id</th>
<th width="60" scope="col">Name</th>
<th width="60" scope="col">Last Name</th>
<th width="42" scope="col">Midterm</th>
<th width="54" scope="col">Class mark</th>
<th width="42" scope="col">Final Quiz</th>
<th width="54" scope="col">State</th>
<th width="54" scope="col">Details</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
$id[]=$rows['id'];
?>
<tr>
<td align="center">
<input name="id[]" type="text" id="id" value="<? echo $rows['id']; ?>" style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 10px;"></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="name[]" id="name" value= "<? echo $rows['name']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="lastname[]" id="lastname" value= "<? echo $rows['lastname']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="midmark[]" id="midmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="classmark[]" id="classmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="finalmark[]" id="finalmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="state[]" id="state" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="details[]" id="details" /></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</center>
<input style="margin-top:10px; float:right; margin-right:175px; font-size: 14px; padding: 5px 14px;" type="submit" value="ثبت" name="Submit" />
</form>
<?php
// Check if button name "Submit" is active, do this
if(isset($_POST['Submit']))
{
for($i=0;$i<$count;$i++)
{
$sql1=mysql_query(" UPDATE `".$tbl_name."` SET midmark='".$_REQUEST['midmark'][$i]."' , classmark='".$_REQUEST['classmark'][$i]."' , finalmark='".$_REQUEST['finalmark'][$i]."' , state='".$_REQUEST['state'][$i]."' , details='".$_REQUEST['details'][$i]."' WHERE id='".$_REQUEST['id'][$i]."' "); $result1=mysql_query($sql1);
}
}
if($result1){
header("location:results.php");
}
mysql_close();
?>