
vikaspa
Members-
Posts
78 -
Joined
-
Last visited
Everything posted by vikaspa
-
Thanks for reply i tried but resulted in syntax error, unexpected token "use" use PHPMailer\PHPMailer\PHPMailer; require 'vendor/autoload.php'; //Create a new PHPMailer instance $mail = new PHPMailer(); /* require "vendor/phpmailer/phpmailer/src/PHPMailer.php"; require "vendor/phpmailer/phpmailer/src/OAuth.php"; require "vendor/phpmailer/phpmailer/src/SMTP.php"; require "vendor/phpmailer/phpmailer/src/POP3.php"; require "vendor/phpmailer/phpmailer/src/Exception.php"; */ // use vendor/phpmailer/phpmailer/src // require "vendor/phpmailer/phpmailer/src/PHPMailer"; //$mail = new PHPMailer ;
-
Dear Respected i had installed phpmailer using composer logged in to cpanel used Terminal to install phpmailer command (@terminal) composer require phpmailer/phpmailer (help found in https://packagist.org/packages/phpmailer/phpmailer ) After installation, I had used following php code to send email require('vendor/autoload.php'); require "vendor/phpmailer/phpmailer/src/PHPMailer.php"; require "vendor/phpmailer/phpmailer/src/OAuth.php"; require "vendor/phpmailer/phpmailer/src/SMTP.php"; require "vendor/phpmailer/phpmailer/src/POP3.php"; require "vendor/phpmailer/phpmailer/src/Exception.php"; // use vendor/phpmailer/phpmailer/src //require "vendor/phpmailer/phpmailer/src/PHPMailer"; $mail = new PHPMailer ; $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; Error Uncaught Error: Class "PHPMailer" not found <in path here> pls help me to solve this issue
-
Dear All, I am uploading an excel with 2 columns Yes i can read excel file. sample attached. Code <?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\IOFactory; try { $spreadsheet = IOFactory::load('uom.xlsx'); $sheet = $spreadsheet->getActiveSheet(); // Get the highest row and column numbers referenced in the worksheet $highestRow = $sheet->getHighestRow(); // e.g. 10 $highestColumn = $sheet->getHighestColumn(); // e.g 'F' // Iterate over each row in the worksheet in turn for ($row = 1; $row <= $highestRow; $row++) { $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); print_r($rowData)."<br>"; } } catch (Exception $e) { echo 'Error loading file: ', $e->getMessage(); } ?> I am getting output Array ( [0] => Array ( [0] => Measure [1] => UPS Code ) ) Array ( [0] => Array ( [0] => Bag [1] => BG ) ) Array ( [0] => Array ( [0] => Barrel [1] => BA ) ) Array ( [0] => Array ( [0] => Bolt [1] => BT ) ) this is result of print_r($rowData)."<br>" so i tried echo "0=".$rowData[0]" 1=".$rowData[1] to get individual cell I get (could not get indivudual cell values. pls help/ guide to get individual cell values Output after above change echo "0=".$rowData[0]" 1=".$rowData[1]; to get individual cell. Array ( [0] => Array ( [0] => Measure [1] => UPS Code )) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Bag [1] => BG ) ) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Barrel [1] => BA ) ) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Bolt [1] => BT ) ) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Box [1] => BOX ) ) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Bunch [1] => BH ) ) Separate Array *** rowData[0] =Array rowData[1] << rowData Array ( [0] => Array ( [0] => Bundle [1] => BE ) )
-
-
PHPExcel read TRUE or FALSE as text and not logical operator
vikaspa replied to vikaspa's topic in PHP Coding Help
Dear All I tacked this issue in following manner when php read a cell that stores "TRUE" or "FALSE" suppose php variable $a1 stores cell A:1<TRUE> php variable $a2 stores cell A:2<FALSE> in this case a1=1 when it gets ($a1 php value) value "TRUE" and a2(cell A:2 value) will have value NULL ($a2 php value) ------------------------------------------------------- php variable $a2 stores cell A:1<TRUE> php variable $a1 stores cell A:2<FALSE> if ( ($a2=='') or ($a2==' ') or ($a2=='')) // check for false and oter variable eis true { $a2='FALSE'; $a1='TRUE'; } php variable $a2 stores cell A:1<FALSE> php variable $a2 stores cell A:2<TRUE> in this case a2=1 when it gets value "TRUE" and a2(cell A:2 value) will have value NULL ------------------------------------------------------- if ( ($a1=='') or ($a1==' ') or ($a1=='')) ) // check for false and other variable true { $a1='FALSE'; $a2='TRUE'; } -
Dear All Using following code We can read data properly except when cell value stored is “TRUE” or “FALSE” I get 1 and blank I want TRUE or FALSE as text and not logical operator How to read / get only values stored in cell My code include(‘PHPExcel-develop/Classes/PHPExcel/IOFactory.php’); try { $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); } catch(Exception $e) { die(‘Error loading file "’.pathinfo($inputFileName,PATHINFO_BASENAME).’": '.$e->getMessage()); } $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // the to get cell data $excelsrno=trim($allDataInSheet[$i][“A”]); $q= trim($allDataInSheet[$i][“B”]); $a1= trim($allDataInSheet[$i][“C”]); $a2= trim($allDataInSheet[$i]["D"] ); $a3= trim($allDataInSheet[$i]["E"] ); $a4= trim($allDataInSheet[$i]["F"] ); $a= preg_replace('/[^0-9]/', '', trim($allDataInSheet[$i]["G"])); $level=trim($allDataInSheet[$i]["H"]); $marks=trim($allDataInSheet[$i]["I"]);
-
I tried the reverse part when timing is blank, uncheck the checkbox however let weekday = $(".weekday[data-id="+id+"]") ; ==> I am getting this undefined pls help code $('.timing').blur(function() { let id = $(this).data("id") let timing=$(this).text().trim(); //text stored in timing console.log('timing text ='+timing); // display the text stored in timing let weekday = $(".weekday[data-id="+id+"]") ; // find timing input with same data-id value // i am getting weekday as unefined console.log( 'timing blur weekday '+weekday ); // timing blur weekday [object Object] if (timing =='') // text is blank { $(weekday).prop('checked', true);// set checkbox checked } }); else { $(weekday).prop('checked', false);// set checkbox un-checked } });
-
<input name="weekday[8]" type="checkbox" value="21" class="weekday" checked=""> <input name="timing[8]" type="text" id="name" value="11" size="45" /> <input name="weekday[9]" type="checkbox" value="99" class="weekday" checked=""> <input name="timing[9]" type="text" id="name" value="12" size="45" /> <input name="weekday[10]" type="checkbox" value="77" class="weekday" checked=""> <input name="timing[10]" type="text" id="name" value="13" size="45" /> I have above html code 1. when checkbox for checkbox name="weekday[8]" is clicked, I want to check whether timing[8] is empty or not (we need to derive field name timing[8] from field name weekday[8] 2. when timing[8] some value is entered , i want to name="weekday[8]" -> checked (we need to derive field name weekday[8] from timing[8] we can find the name (jquery) $('.weekday').click(function(){ var checkboxname=$(this).attr('name'); // we get checkbox clicked name=name[8] console.log('checkbox name='+checkboxname); }) In simple case (without dimension) this is easy we get name of field (checkbox is clicked) as name[8] i want to derive field name timing[8] i tried (jquery) $('.weekday').click(function(){ var checkboxname=$(this).attr('name'); console.log('checkboxname='+checkboxname);// i got this correct weekday[8] in this case var splitname=checkboxname.split('weekday');// seperated [8] , console.log(splitname[0]+' 1='+splitname[1]); //splitname[1] will have [8] //now want to form or generate value of variable mobile[8] var n='mobile'+splitname[1];//the n will be mobile[8] console.log('n='+n);// ths will be mobile[8] var inp=$('input[name="'+n+'"]').val(); console.log(' inp='+inp);// but no success //here I want value of $('input[name=name[8]').val(); }) Please guide how i derive (using jquery) filed name mobile[8] from filed name[8]
-
Accept input with dimensions and store in database
vikaspa replied to vikaspa's topic in PHP Coding Help
This solved the problem Thanks a ton -
Accept input with dimensions and store in database
vikaspa replied to vikaspa's topic in PHP Coding Help
I really appreciate prompt reply As specified by you I am getting values for $_POST['weekday'][$i] code do { //reading weekday table and assigning id as index ?> <tr> <td class='text15' > <input name="weekday[<?php $rows['id'];?>]" type="checkbox" value="<?php echo $rows['id'];?>" class='weekday' /> <?php echo $rows['name'] ;?> <br>Timing <input type="text" name="timing[<?php $rows['id'];?>]" class='timepicker timing' /> </td> </tr> <?php } while ($rows=$query->fetch()); ?> after submit $cntr=count($_POST['weekday']); echo "weekday count=".count($_POST['weekday']); echo "timing count=".count($_POST['timing']); for($i=8; $i < 18 ; $i++) { echo "<br>".$i." Loop Week day =>". $_POST['weekday'][$i]." timing =>". $_POST['timing'][$i]; } output weekday count=5 8 Loop Week day => timing => 9 Loop Week day =>9 timing => 10 Loop Week day =>10 timing => 11 Loop Week day =>11 timing => 12 Loop Week day =>12 timing => 13 Loop Week day =>13 timing => 14 Loop Week day => timing => 15 Loop Week day => timing => 16 Loop Week day => timing => 17 Loop Week day => timing => We get the values for weekday[9], weekday[10], weekday[11], weekday[12], weekday[13] ------------------------------------------------------------ but not getting any values for timing[9], timing[10], timing[11], timing[12], timing[13] pls help -
Dear All I am accepting following 2 field in a form one is checkbox and another is input <input name="weekday[]" type="checkbox" value="<?php echo $rows['id'];?>" class='weekday' /> <?php echo $rows['name'] ;?> <br>Timing <input type="text" name="timing[]" ' class='timepicker ' /> the form look like this (refer image) after submit i can get checkbox value After submit I tried $cntr=count($_POST['weekday']); for($i=0; $i < $cntr=count($_POST['weekday']) ; $i++) { echo "<br>".$i." Loop Week day =>". $_POST['weekday'][$i]." timing =>". $_POST['timing'][$i]; // Addcenterdaystime($staffcompanyid, $newid, $_POST['weekday'][$i], $_POST['timing'][$i] ) ; } However could not get values of timing pls help
-
thanks a lot
-
Dear Sir if (version_compare(PHP_VERSION, '5.3', '>=')) { error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); } else { error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); } I want to know whether this code DONOT ALLOW execution in case PHP verson is > 5.3 and above complete code switch (ENVIRONMENT) { case 'development': error_reporting(-1); ini_set('display_errors', 1); break; case 'testing': case 'production': ini_set('display_errors', 0); if (version_compare(PHP_VERSION, '5.3', '>=')) { error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); } else { error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); } break; default: header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'The application environment is not set correctly.'; exit(1); // EXIT_ERROR }
-
Dear GIZMOLA Thanks a TON for the reply. I will check this and revert
-
Dear All Code generated from https://github.com/dompdf/dompdf/issues/2481 I am using dompdf 2.0 Main program to create pdf https://prajaktasoftware.com/onlineexam/vendor-special-message.php <- input html file forms input to generated PDF https://prajaktasoftware.com/onlineexam/testfont-1.php <- program that generates pdf using above program I am using dompdf (testfont-1.php) the output generated shows ??? characters pls help <?php ob_start(); include 'vendor-special-message.php'; // pdf generatef from this file $_template = ob_get_clean(); require( 'dompdf/autoload.inc.php'); use Dompdf\Dompdf; $dompdf=new Dompdf(); //$dompdf->loadHtml($_template, "UTF-8"); $dompdf->loadHtml($_template, "UTF-8"); $dompdf->setPaper("A4", "portrait"); $dompdf->set_option('isFontSubsettingEnabled', true); $dompdf->set_option('defaultMediaType', 'all'); $dompdf->set_option('isRemoteEnabled', true); $dompdf->render(); $dompdf->stream( time() . ".pdf", array("Attachment" => false)); // $dompdf->stream(); // stream the pdf in browser exit; ?> vendor-special-message.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Hind:wght@300&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200&display=swap'); div {font-family: 'Hind', sans-serif;} body { font-family: 'Oswald', sans-serif } </style> </head> <body> <p>Happy Birthday</p> <p>Happy Birthday</p> <p>Happy Birthday</p> <div>सभ मानव जन्मतः स्वतन्त्र अछि तथा गरिमा आʼ अधिकारमे समान अछि। सभकेँ अपन–अपन बुद्धि आʼ विवेक छैक आओर सभकेँ एक दोसराक प्रति सौहार्दपूर्ण व्यवहार करबाक चाही।</div> </body> </html>
-
Dear All Can I display display url http://www.mywebsite.com/abcd.php?id=1 as http://www.mywebsite.com/abcd.php/1 or http://www.mywebsite.com/contact.php as http://www.mywebsite.com/contact pls help
-
Dear All I am trying to seperate the rows from a table (html) in order to do this as a 1st step I am doing $str1 = preg_replace('/<tr >/', "<tr>", $str1); $str1 = preg_replace('/<td >/', "<td>", $str1); so that all <tr > will become <tr> .. removing space and <td > will become </td>.. removing spaces As a next step I am trying $str1 = preg_replace('/<tr> <td>/', "\n", $str1); replace start of row with \n i.e. new line feed But it doesnot work pls help <tr> <td> दिनांक</td> <td> वार</td> <td> मास</td> <td> कृष्ण / शुक्ल</td> <td> तिथी</td> <td> वार</td> <td> यात्रा/जत्रा/ ऊरुस/ उत्सव/ जयंती/ पुण्यतिथी</td> <td> ठिकाण</td> <td> तालुका जिल्हा</td> </tr> I have Unicode data ..whether the unicode data is an issue or something else Pls help no replacements are made
-
Dear All I have unicode data in following sheet https://docs.google.com/spreadsheet/ccc?key=0AnL8C-M5yG2odEtqanRNSTBGdGZubk81dFQzUEdqOEE#gid=0 This data is in Devnagari I tried to save as (download as from this data sheet - comma separated values) and then upload data But when i read the data, I am getting junk characters .... in short could not read data in the font seen in this file
-
<html> <head> <title>the title</title> <script type="text/javascript" src="javascript/jquery-1.4.2.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function() { $("#driver").click(function(event){ $('#stage').load('contactus.php'); }); $("#stage").click(function(event){ $('#stage').load('photogallery.php?cid=36&&subcid=48'); }); }); </script> </head> <body> <p>Click on the button to load result.html file:</p> <div id="stage" style="background-color:blue;"> STAGE </div> <input type="button" id="driver" value="Load Data" /> </body> </html> I tried this ajax the contactus.php is getting loaded however the link with parameters photogallery.php?cid=36&&subcid=48 show blank page please help
-
Dear All Salute to this forum .... Please refer following link http://m2k-education.com/a001.php This link displays a video in videobox.js & videoboox.css The video file name is used in link ..on click the said video is opened up like 'lightbox' I want to avoid using video name in link instead want to pass the id of the video to ajax which will open up this video Can i do this ? Please please help Thanks in advance 18664_.php
-
Dear All need help in ajax-PHP i am using following code to display video. <a href="<?php echo $vrows['image1'] ; ?> " rel="vidbox" title="<?php echo $vrows['name']."<br>".nl2br($rows['detail']) ; ?>" id="m5"><?php echo $vrows['name'].$vrows['id'] ; ?></a> However using right click one can download the video (which client donot want to happen) I am thinking of using AJAX in following manner (this may be different so as to use AJAX) Note: I tried disabling of right click but it doesn't work chrome This is what i want to happen using AJAX on click the link will pass value of row id (INSTEAD OF FILE NAME) AND WE NEED TO open the video in videobox