Category

PHP

Category

Step 1: Create Database Table CREATE TABLE `info` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Step 2: Create index.php File <html> <head> <title>jQuery Add & Remove Dynamically Input Fields in PHP</title> </head> <body> <h1>jQuery Add & Remove Dynamically Input Fields in PHP</h1> <form name=”add_me” id=”add_me”> <table id=”dynamic”> <input type=”text” name=”name[]” placeholder=”Enter Your Name” /> <button type=”button” name=”add” id=”add_input”>Add</button> </table> <input type=”button” name=”submit” id=”submit” value=”Submit” /> </form> <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-rc1/jquery.min.js”></script> <script>…

<?php $html = file_get_contents(‘https://www.practo.com/search?results_type=doctor’); //get the html returned from the following url $pokemon_doc = new DOMDocument(); libxml_use_internal_errors(TRUE); //disable libxml errors if(!empty($html)){ //if any html is actually returned $pokemon_doc->loadHTML($html); libxml_clear_errors(); //remove errors for yucky html $pokemon_xpath = new DOMXPath($pokemon_doc); //get all the h2’s with an id $pokemon_row = $pokemon_xpath->query(‘//h2[@class]’); if($pokemon_row->length > 0){ foreach($pokemon_row as $row){ echo $row->nodeValue . “<br/>”; } } } ?> Read More: https://gist.github.com/anchetaWern/6150297

<?php header(‘Content-type: application/excel’); $filename = ‘filename.xls’; header(‘Content-Disposition: attachment; filename=’.$filename); $data = ‘<html xmlns:x=”urn:schemas-microsoft-com:office:excel”> <head> <title>Page Title</title> </head> <body> <table><tr><td>Cell 1</td><td>Cell 2</td></tr></table> </body></html>’; echo $data; ?>

https://youtu.be/4p4kI60POYs <?php //index.php $error = ”; $name = ”; $email = ”; $subject = ”; $mobile = ”; $message = ”; function clean_text($string) { $string = trim($string); $string = stripslashes($string); $string = htmlspecialchars($string); return $string; } if(isset($_POST[”submit”])) { if(empty($_POST[”name”])) { $error .= ‘<p><label class=”text-danger”>Please Enter your Name</label></p>’; } else { $name = clean_text($_POST[”name”]); if(!preg_match(“/^[a-zA-Z ]*$/”,$name)) { $error .= ‘<p><label class=”text-danger”>Only letters and white space allowed</label></p>’; } } if(empty($_POST[”email”])) { $error .= ‘<p><label class=”text-danger”>Please Enter your…

https://youtu.be/Cw8mCIK2oIY Create index.php file and put code inside of index.php file In this tutorial, we will learn how to data store inside of CSV file using PHP. CSV is a comma-separated value file in which it stores tabular data in plain text format. It stores one record in one line and for the second record, it will store in the second line. <?php //index.php $error = ”; $name = ”; $email = ”; $subject =…

There are many differences between PHP 5 and 7. Some of the main points are: Performance: PHP 7: Performance speed is double. Average requests per second are 44 when it is 22 in php5. PHP 5: Performance is low compared to php7. Return Type: In PHP 5, the programmer is not allowed to define the type of return value of a function which is the major drawback. But in PHP 7, this limitation is overcome…

Q1) Write a program for a pattern ? * * * * * * * * * * * * * * * Answer <?php for($i=0;$i<=5;$i++){ for($j=5-$i;$j>=1;$j–){ echo “*&nbsp;”; } echo “<br>”; } ?> Q2) Write a program for this pattern? * * * * * * * * * * * * * * * Answer <?php for($i=0;$i<=5;$i++){ for($j=1;$j<=$i;$j++){ echo “*&nbsp;”; } echo “<br>”; } ?> Q3) Write a program for this pattern? *…