Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About webchambers1

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. This link is driving me crazy <a id ="savepdf" href="invoice.php?invoice_id=<?=$invoiceID?>"value="Save This Invoice"><button class="block" id ="printbtn" onclick="myFunction()";>Save Invoice</button></a> when a user selects this link it works ok saves a pdf file to a folder on server. i want to relocate after link submitted. If i use this link it does redirect but does not save the pdf file to folder on server <a id ="savepdf" href="invoice.php?invoice_id=<?=$invoiceID?>"value="Save This Invoice" onclick="window.location.href='mypage.php'; ;return false;"><button class="block" id ="printbtn" onclick="myFunction()";>Save Invoice</button></a>
  2. Hi, I have a form where a user selects a file to attach to the email. At the moment when you select a file it uploads from the user device. How do i change this so that a user can attach a file from a folder on the server. For example the folder name is uploadinvoice so when the user selects the browse button to attach a file it opens up the uploadinvoice folder on the server so the user can select the file from there ? Thanks coding i have at moment function ValidateEmail($email) { $pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i'; return preg_match($pattern, $email); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form1') { $mailto = $_POST['youremail']; $mailfrom = isset($_POST['myemail']) ? $_POST['myemail'] : $mailto; $subject = 'Message'; $message = 'Message'; $success_url = './test.php'; $error_url = ''; $eol = "\n"; $error = ''; $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response"); $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; try { if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n<br>"; throw new Exception($error); } $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; }
  3. Hi, I have a page that creates a pdf file the button saves the pdf to a file on my server then the onclick function i want to send the page to a frame called userframe. so Target=“userframe” i have tried putting this in different places in the code but it always opens up the page in a new tab ? Do not get confused with id printbtn this is NOT to open print dialog its just a name to gave to css class. my code <a id =“savepdf” href="invoice.php?invoice_id=<?=$invoiceID?>"value=“Save This Invoice”><button class=“block” id =“printbtn” onclick =“window.open(‘https://www.mywebsite.com’)”;>Save Invoice</a>
  4. Hi Guys i need help on a small matter. if you go to https://www.mywebchambers.co.uk/invoiceman/form.php when submitted all works ok. However if you delete rows 3, 4 and 5 and submit the page shows a value of 0.00 in the total column on rows 3, 4 and 5. How do i get this value removed so it is blank same as the rest ? My form action is toolstation3.php code below <!doctype html> <html> <head> <meta charset="utf-8"> <title>Toolstation</title> <meta name="generator" content="WYSIWYG Web Builder 14 - http://www.wysiwygwebbuilder.com"> <link href="toolstation.css" rel="stylesheet"> <link href="toolstation.css" rel="stylesheet"> </head> <body> <?php {$orderno =($_POST["orderno"]);} {$date =($_POST["date"]);} {$totalvalue =($_POST["totalvalue"]);} {$code1 =($_POST["code1"]);} {$name1 =($_POST["name1"]);} {$price1 =($_POST["price1"]);} {$amount =($_POST["amount"]);} {$quantity1 =($_POST["quantity1"]);} {$total =($_POST["total"]);} {$contact1 =($_POST["contact1"]);} {$contact2 =($_POST["contact2"]);} {$contact3 =($_POST["contact3"]);} {$contact4 =($_POST["contact4"]);} {$contact5 =($_POST["contact5"]);} {$depot =($_POST["depot"]);} {$company =($_POST["company"]);} {$title =($_POST["title"]);} {$firstname =($_POST["firstname"]);} {$lastname =($_POST["lastname"]);} {$mobile =($_POST["mobile"]);} {$email =($_POST["email"]);} {$vatband1 =($_POST["vatband1"]);} {$code2 =($_POST["code2"]);} {$name2 =($_POST["name2"]);} {$price2 =($_POST["price2"]);} {$quantity2 =($_POST["quantity2"]);} {$vatband2 =($_POST["vatband2"]);} {$code3 =($_POST["code3"]);} {$name3 =($_POST["name3"]);} {$price3 =($_POST["price3"]);} {$quantity3 =($_POST["quantity3"]);} {$vatband3 =($_POST["vatband3"]);} {$code4 =($_POST["code4"]);} {$name4 =($_POST["name4"]);} {$price4 =($_POST["price4"]);} {$quantity4 =($_POST["quantity4"]);} {$vatband4 =($_POST["vatband4"]);} {$code5 =($_POST["code5"]);} {$name5 =($_POST["name5"]);} {$price5 =($_POST["price5"]);} {$quantity5 =($_POST["quantity5"]);} {$vatband5 =($_POST["vatband5"]);} {$sum1 =($_POST["sum1"]);} {$sum2 =($_POST["sum2"]);} {$sum3 =($_POST["sum3"]);} {$sum4 =($_POST["sum4"]);} {$sum5 =($_POST["sum5"]);} {$nil =($_POST["nil"]);} {$net =($_POST["net"]);} {$vat =($_POST["vat"]);} {$percentage =($_POST["percentage"]);} $sum1=$quantity1*$price1; $sum2=$quantity2*$price2; $sum3=$quantity3*$price3; $sum4=$quantity4*$price4; $sum5=$quantity5*$price5; $net=$sum1+$sum2+$sum3+$sum4+$sum5; $total=$net+$vat; $vatrate=20; $vat=$net/100*20; $total=$net+$vat; $sum1 = number_format($sum1, 2, '.', ''); $sum2 = number_format($sum2, 2, '.', ''); $sum3 = number_format($sum3, 2, '.', ''); $sum4 = number_format($sum4, 2, '.', ''); $sum5 = number_format($sum5, 2, '.', ''); $net = number_format($net, 2, '.', ''); $vat = number_format($vat, 2, '.', ''); $total = number_format($total, 2, '.', ''); if(empty($_POST['quantity3']) && empty($_POST['price3'])) {echo " $nil";} $nil=''; echo "<H3> &nbsp&nbsp Toolstation Invoice"; echo "<br>&nbsp&nbsp&nbsp____________________________________________________________________________________________________<br><br>"; echo "<H3> &nbsp&nbsp Address &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Details "; echo "<br>&nbsp&nbsp&nbsp___________________________________________________________ &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp____________________________________<br><br>"; echo "<table cellpadding=3 border=0 style='float:left'>"; echo "<tr> <td>Contact<br><br>$contact1<br>$contact2<br>$contact3<br>$contact4<br>$contact5</td> </td>"; echo "</table>"; echo "<table cellpadding=3 border=0 style='float:left'>"; echo "<tr> <td>Delivery<br><br>$contact1<br>$contact2<br>$contact3<br>$contact4<br>$contact5</td> </td>"; echo "</table>"; echo "<table cellpadding=3 border=0 style='float:left'>"; echo "<tr> <td>Payment &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<br><br>$contact1<br>$contact2<br>$contact3<br>$contact4<br>$contact5</td> </td>"; echo "</table>"; echo "<table cellpadding=3 border=0 style='float:left'>"; echo "<tr> <td>Order No<br>Placed On<br>Completed On<br>Total Value<br>Currency<br>Depot<br>Payment<br>UID<br>Company<br>Title<br>First Name<br>Last Name<br>Mobile<br>E Mail</td> </td>"; echo "</table>"; echo "<table cellpadding=3 border=0>"; echo "<tr> <td>QR4298562763000001<br>$date<br>$date<br>$total<br>GBP<br>Rotherham (R4)<br>Cash<br>CWW01074397<br>$company<br>$title<br>$firstname<br>$lastname<br>$mobile<br>$email</td> </td>"; echo "</table>"; echo "<H3> &nbsp&nbsp Items"; echo "<br>&nbsp&nbsp&nbsp__________________________________________<br><br>"; echo "<table cellpadding=3 border=1>"; echo "<tr><th>Code</th><th>Name</th><th>Quantity</th><th>Price</th><th>Total</th><th>Vat Band</th></tr>"; echo "<tr><td>$code1</td><td>$name1</td><td>$quantity1</td><td>$price1</td><td>$sum1</td><td>$vatband1</td> "; echo "<tr><td>$code2</td><td>$name2</td><td>$quantity2</td><td>$price2</td><td>$sum2</td><td>$vatband2</td> "; echo "<tr><td>$code3</td><td>$name3</td><td>$quantity3</td><td>$price3</td><td>$sum3</td><td>$vatband3</td> "; echo "<tr><td>$code4</td><td>$name4</td><td>$quantity4</td><td>$price4</td><td>$sum4</td><td>$vatband4</td> "; echo "<tr><td>$code5</td><td>$name5</td><td>$quantity5</td><td>$price5</td><td>$sum5</td><td>$vatband5</td> "; echo "</table>"; echo "<br>"; echo "<H3> &nbsp&nbsp VAT Analysis"; echo "<br>&nbsp&nbsp&nbsp__________________________________________<br><br>"; echo "<table cellpadding=5 border=1>"; echo "<tr><th>Band</th><th>Rate</th><th>Net</th><th>VAT</th><th>Total</th></tr>"; echo "<tr><td>5</td><td>20%</td><td>$net</td><td>$vat</td><td>$total</td> "; echo "</table>"; ?> <div id="container"> </div> </body> </html>
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.