209 Posted Topics
Re: Try this <?php $yourString = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vulputate, purus mollis volutpat faucibus, velit ligula egestas neque, ac gravida ante lacus et dolor. Maecenas blandit aliquet sem ac suscipit. Proin nec tortor dui. Sed bibendum mollis elementum.'; $strlimit=100; echo substr ($yourString,0, $strlimit).' .............'; ?> | |
![]() | Re: Ymax<input type="text" name="Ymax" id="Ymax" size="15"> <input type="button" name="submit" class="submitBtn" VALUE="Submit"> <script type="text/javascript"> $(function(){ $('.submitBtn').click(function(){ $.post('otherPhpPage.php',{Ymax: $('#Ymax').val()},function(data){ alert(data); }); }); }); </script> <!--########## In otherPhpPage.php ######## --> <?php echo $yMax=$_REQUEST['Ymax']; ?> Result of this code will show an alert with your entered Ymas value |
Re: Try This <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Form - validate - Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <form method="post" name="myForm"> <span class="formError email">Please Enter Valid Email</span> <input type="text" name="Email" id="email" onKeyUp="checkEmail()" /> <input type="submit" value="Send" name="submitButton" /> </form> <style> .formError{ … | |
Re: Check this http://www.thimbleopensource.com/tutorials-snippets/jquery-plugin-filter-text-input | |
Re: Try this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Form - Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div class="formDiv"> <table id="myTable" width="600px" cellpadding="0px" cellspacing="0px"> <tr><td>First Name</td><td><input type="text" name="txtFirstName[]" /></td></tr> <tr><td>Last Name</td><td><input type="text" name="txtLastName[]" /></td></tr> </table> </div> <hr /> <div class="appendDiv"> </div> <input … | |
Re: Try this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Text-Link-Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <a href="#NOD" class="showSections" rel="show">Show information</a> <div class="catSections" style="display: none;"> <h1>Helloo</h1> </ul> </div> <script type="text/javascript"> $(function(){ $('.showSections').live('click', function() { if($(this).attr('rel')=='show'){ $('.catSections').fadeIn(); $('.showSections').attr('rel','hide'); $('.showSections').html('Hide information'); } else if ($(this).attr('rel')=='hide') … | |
Re: Try this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Toggle-Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> <style type="text/css"> #flip { padding:5px; text-align:center; background-color:#e5eecc; border:solid 1px #c3c3c3; } #box1 { margin:10px; height:auto; } #panel1,#panel2,#panel3 { padding:5px; text-align:center; background-color:#e5eecc; border:solid 1px #c3c3c3; padding:50px; display:none; } </style> </head> … | |
Re: Try this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test-String-Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <title>Exam entry</title> </head> <body> <script type="text/javascript"> $(function(){ var str = "INC300051546,INC300051553,INC300051561,INC300051579";//Test your string here var seperators = ['.',';'];// add your expected seperators here var firstFlag = true; var … | |
Re: Try this <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function(){ var artists_arr = new Array(); artists_arr[0] = "The Beatles"; artists_arr[1] = "The Doors"; artists_arr[2] = "The Cascades"; for (i=0;i<artists_arr.length;i++) { $('#Artists').append('<option value="'+artists_arr[i].toUpperCase()+'">'+artists_arr[i].toUpperCase()+'</option>'); } <?php if(isset($_POST['submit'])){ ?> var val = '<?php echo $_POST['artists']; ?>'; $("#Artists option").filter(function() { return $(this).text() == val;}).attr('selected', true); … | |
Re: Try this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Table-Text-Area Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <table id="myTable" width="200px" cellpadding="0px" cellspacing="0px"> <tr><td><label for="Cname"> No of Partipants:</label></td><td> <select style="width:160px;" id="text" name="participants" required="required" > <option id="" value="0" name="">-Select participant-</option> <option id="1" value="1" name="" >1</option> <option … | |
Re: Try this http://docs.jquery.com/Plugins/Validation | |
Re: In your table, set a field with primary key and auto increment options , ie ; Row ID; Then ; in your query , set SELECT FieldNameId FROM your_Table ORDER BY FieldNameId DESC LIMIT 0, 1; the result of this query will give last row Id ![]() | |
Re: Try this Exg : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Table Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <table id="myTable" width="200px" cellpadding="0px" cellspacing="0px"> <tr> <td>One</td> <td>Two</td> <td>Three</td> </tr> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> </table> <script type="text/javascript"> $(function(){ $('#myTable').mouseover(function() { $(this).css('text-align','center'); $(this).css('border','1px solid'); … | |
Re: Pass students id's ,in your form with <input type="checkbox" checked="checked" name="att[]" value="1" /> <input type="hidden" name="stdId[]" value="<?php echo $id; ?>" /> in attendance.php <?php $att = $_POST['att']; $stdId = $_POST['stdId']; foreach($att as $key => $attendance) { $at = $attendance ? 'P' : 'N'; $query = "INSERT INTO `attendance`(`stud_id`,`att`) VALUES ('".$stdId[$key]."','".$at."') … | |
Re: Try this <?php if (isset($_POST['generator'])) { $charset = 'absdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ0123456789%$#-()*&.,'; $generated_password = substr (str_shuffle($charset),0, 12); } ?> <form action ="" method="post"> <input type="submit" name="generator" value="Generate"><input type="text" value="<?php if (isset($generated_password)) {echo $generated_password; } ?>"/> </form> | |
Re: In your listing page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Gallery Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <label for="filterBox">Box1</label> <select name="filterBox" id="filterBox"> <option value="">- Select -</option> <option value="Windows">Windows</option> <option value="Linux">Linux</option> </select><br /> <div class="filterResults"> <h1>Windows</h1> <h1>Linux</h1> </div> <script type="text/javascript"> $(function(){ $('#filterBox').change(function(){ … | |
Re: Use Jquery .. Try this .. Exg: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Gallery Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <a href="#page1" class="link" rel="1">pic1</a> <a href="#page2" class="link" rel="2">pic2</a> <div class="Page page1" style="display: none;"> <h1>Gallery-1</h1> </div> <div class="Page page2" style="display: none;"> <h1>Gallery-2</h1> … | |
Re: Try This <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Gallery Exg</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <label for="box1">Box1</label> <select name="box1" id="box1"> <option value="1">number</option> <option value="2">letter</option> </select><br /> <label for="box2">Box2</label> <select name="box2" id="box2"> <option value="">-- Select Value --</option> <option value="1">1</option> <option value="2">2</option> <option … | |
Re: <?php // If $search_exploded = array('searchValue1','searchValue2','searchValue3'); // this means $search_exploded[0]=searchValue1;$search_exploded[1]=searchValue2;$search_exploded[2]=searchValue3 $construct=""; foreach($search_exploded as $x=>$search_each) { //$x -> index of an array; Here 0,1,2 //$search_each -> Value of array ; hear 'searchValue1','searchValue2','searchValue3' $x++; if($x==1) $construct .="keywords LIKE '%$search_each%'"; else $construct .=" AND keywords LIKE '%$search_each%'"; } echo $construct; // Output is … | |
Re: Change this $dob= $_POST['dob']; to if(isset($_POST['dob'])) $dob = $_POST['dob']; $dob = 'xx/xx/xxxx'; | |
Re: Try this <?php $urls="list.txt"; $page = join("",file("$urls")); $kw = explode("|", $page); $count=0; $arrayRow=0; $links = array(); $images = array(); $widths = array(); $heights = array(); foreach($kw as $key=>$vl) { $count++; if ($count==1) $links[$arrayRow] = $vl; if ($count==2) $images[$arrayRow] = $vl; if ($count==3) $widths[$arrayRow] = $vl; if ($count==4){ $heights[$arrayRow] = $vl; … | |
![]() | |
Re: Try this http://code.google.com/p/dompdf/ include_once("dompdf/dompdf_config.inc.php"); $dompdf= new DOMPDF(); if(isset($_REQUEST['txtContent'])){ $content=''; $content.='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head><html><body>'; $content.=$_REQUEST['txtContent']; $content.='</body></html>'; if(empty($content)) { $error="Please enter contents"; } else { $fileName=$_REQUEST['fileName'].'.pdf'; $dompdf->load_html($content); $dompdf->render(); $dompdf->set_paper(array(0,0,900,800)); $dompdf->stream($fileName); } } | |
Re: Try this <?php class myClass { public $str; private $pinCode = 111; function printPrivateVariable() { echo $this->pinCode; } } //object $ob = new myClass(); $ob -> str = "This is a string."; //code before the exception echo $ob -> str.'<br />'; if($ob -> printPrivateVariable()) { throw new Exception("this is private … | |
Re: First you check, is posted file exist or not EXg: $yourFile = "uploads/".$_POST['selectBoxName']; $checkFile = fopen($yourFile, 'w') or die("can't open file"); fclose($checkFile); If file exist, then unlink($yourFile); | |
Re: You can use different methodes for generating transactionreference Id and OrderId. I prefer, create those id's related to your order table insert id | |
Re: First you save the user_id, action_type (IN or OUT) and current_time of user on table. Then check last action type of that user. If last action_type is IN , show punch out button, else show punch in button. | |
Re: Check this <?php if (isset($_POST['Submit'])) { $pro_name = $_POST['product_name']; $pro_reg_date = $_POST['regstr_date']; $renewal_date = $_POST['renewal_date']; $product_shelf = $_POST['pro_shelf_life']; $countries = $_POST['country']; $Id=(@mysql_result(@mysql_query("SELECT max(product_id) from products"),0,0)+1); $c_Id=(@mysql_result(@mysql_query("SELECT max(country_id) from country"),0,0)+1); $c_w_id = (@mysql_result(@mysql_query("SELECT max(c_w_p_id) from country_wise_products"),0,0)+1); $sql1 = "INSERT INTO products (product_id, product_name, pro_regt_date, pro_renew_date, product_shelf_life) VALUES ('$Id', '$pro_name', '$pro_reg_date', '$renewal_date', … | |
Re: Change this print '<option value="'.$colour.''.$sel.'>'.$cname.'</option>'; to print '<option value="'.$colour.'" '.$sel.'>'.$cname.'</option>'; | |
Re: Check this else { // form submitted // set server access variables $host = "localhost"; $user = "root"; $pass = ""; $db = "books"; $search = empty($_POST['search'])? die ("ERROR: Enter Search Criteria") : mysql_escape_string($_POST['search']); $dropdown = empty($_POST['dropdown'])? die ("ERROR: Select from dropdown") : mysql_escape_string($_POST['dropdown']); // Open Connection $connect = mysql_connect($host, … | |
Re: 1; Set user type for user , ie , if type=0 -> admin user , and type=1 -> normal user 2; When a user login your site, check type of user and save it in a session variable. 3; Check the value of session variable, when each page load and … | |
Re: When I test your code like <?php class DateTest { public function inputEndDate() { $value = date('Y/m/d'); $html = ""; $html .= '<label for="enddate">End Date:</label>' . PHP_EOL; $html .= '<input type="text" readonly name="enddate" id="enddate" value="'.$value.'">'; $html .= '<input type="button" id="enddatebutton" onclick="getEndDate()">' . PHP_EOL; return $html; } public function inputExpiryDate() { … | |
Re: A Simple methode is upload your file to your server location and take that uploaded file path. Attach this filepath to your mail content for download this file. | |
Re: Try this $pass = md5($_POST['password']); $id_user= $_POST[username]; $login = mysql_query("SELECT * FROM user WHERE id_user='$id_user' AND sesi='$pass'"); $found = mysql_num_rows($login); | |
Re: <?php $targetPath = $_SERVER['DOCUMENT_ROOT'].'/upload/'; if (isset($_POST['submit'])){ $filename = basename( $_FILES['file']['name'], ".pdf"); if($_FILES['file']['type']=='application/pdf') { $filename = preg_replace("/[^A-Za-z0-9_-]/", "", $filename).".pdf"; $thumb = basename($filename, ".pdf"); $cpy=1; do { $targetFile = str_replace('//','/',$targetPath) ."Copy".$cpy. $filename; $filename="Copy".$cpy. $_FILES['file']['name']; $cpy++; }while(is_file($targetFile)); if(move_uploaded_file($_FILES['file']['tmp_name'], $targetPath.$filename)) { $pdfWithPath = $targetPath.$filename; echo "File Uploaded Successfully"; } } else { echo "Please … | |
Re: Exg: In your Form .. <input type="checkbox" name="chk[]" value="1" /> <input type="checkbox" name="chk[]" value="2" /> <input type="checkbox" name="chk[]" value="3" /> In action page <?php if($_POST['chk']) { $chekedValues= array(); $chekedValues = $_POST['chk']; $append=""; foreach ($chekedValues as $key=>$value) { $append.=($key==0) ? 'WHERE ' : 'OR'; $append.= " db_table_field_name="."'".$value."'"; } $sqlsearch = mysql_query("SELECT … | |
Re: Try this <?php $sqlsearch = mysql_query("SELECT * FROM tblteacher_info WHERE Fname='$iFName' AND Mname='$iMName' AND Lname='$iLName'",$open_con); if(!$sqlsearch) { die("Database connection failed:" . mysql_error()); } else { if(mysql_num_rows($sqlsearch)>0) { $i_sqlupdate = mysql_query("UPDATE tblteacher_info SET Fname='$iFName', Mname = '$iMName', Lname = '$iLName', Username ='$username', Password='$password' WHERE Lname = '$iFName' AND Mname ='$iMName' AND … | |
Re: In form <tr bgcolor="<?php echo $bg; ?>"> <td><?php echo $rows['firstName']." ".$rows['lastName']." ".$rows['otherName']; ?></td> <td><?php echo $rows['regNo']; ?></td> <td><?php echo $rows['class']." ".$rows['stream']; ?></td> <td><div align="center"><input type="text" name="bot[]" size="10" /></div></td> <td><div align="center"><input type="text" name="mt[]" size="10" /></div></td> <td><div align="center"><input type="text" name="eot[]" size="10" /> <input type="hidden" value="<?php echo $rows['school_id']; ?>" name="schoolId[]"> </div></td> </tr> In … | |
Re: <?php $sql=mysql_query("SELECT * FROM `products` where tf=1 and star='7' ORDER BY `id` DESC"); $inc = 0; while($r=mysql_fetch_array($sql)){ $inc++; $id=$r['id']; ?> <div style="width:152px; height:205px;"> <?php echo $id; ?> </div> <?php if($inc%4==0) echo '<hr />'; } ?> Here I have seperated each 4 items by hr tag.. This will help you... to … | |
![]() | Re: In form.php <html> <body> <form action="number.php" method="post"> Enter number: <input type="text" name="number" /><br /><br /> Enter number to Add: <input type="text" name="add" /><br /><br /> Enter number to Subtract: <input type="text" name="subtract" /><br /><br /> Enter number to multiply: <input type="text" name="multiply" /><br /><br /> Enter number to divide: <input … ![]() |
Re: <?php $database_value='a'; $chka = ($database_value=='a') ? 'checked' : ''; $chkb = ($database_value=='b') ? 'checked' : ''; $chkc = ($database_value=='c') ? 'checked' : ''; ?> <input type="checkbox" name="chka" <?php echo $chka; ?> value="a" /> <input type="checkbox" name="chkb" <?php echo $chkb; ?> value="b" /> <input type="checkbox" name="chkc" <?php echo $chkc; ?> value="c" … | |
Re: http://www.uploadify.com/ this link will help you | |
Re: 1; set $searchResult= array(); 2; Check each tables and push all results to the array $searchResult, like below $sql="SELECT * FROM df_restaurent WHERE (df_restaurent.Address LIKE '%$query1%' ) GROUP BY RestaurentId ;"; $result=$this->db->query($sql); $data=$this->db->fetchAll($result); foreach($data as $dd) { array_push($searchResult, array( "Page" => "RestaurentDetails", "RestaurentId"=>"$dd->RestaurentId" )); } 3; At the end of … | |
Re: http://wcetdesigns.com/tutorials/demos/watermark.html Check this | |
Re: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /site/inner.php?page=$1 [L] </IfModule> 1;First you create a page inner.php 2;Set htacess with above code 3;Set inner.php <?php $page= (isset($_REQUEST['page']) || $_REQUEST['page'] != "")? $_REQUEST['page'] : "index"; include_once($page.".php"); ?> **NB: the resquested page name should be same as your … | |
Re: <html> <head> <title>currency Convert</title> </head> <body> <?php $amount = (isset($_POST['amount'])) ? $_POST['amount'] : 0; $slt1 = (isset($_POST['form']) && $_POST['form']=="taka") ? 'selected="selected"' : ''; $slt2 = (isset($_POST['form']) && $_POST['form']=="rupe") ? 'selected="selected"' : ''; $slt3 = (isset($_POST['form']) && $_POST['form']=="inr") ? 'selected="selected"' : ''; ?> <form action="" method="POST"> <table> <tr> <td> <lebel>$</label> <input … | |
Re: date ('d/m/y \a\t H:i'); OR date ('d/m/y').' at '.date('H:i'); | |
Re: Get the status of that check box from your DB table.You may be saved that in 0(not checked) or 1 (checked).Check this status when you update the profile. Exg: <input type="checkbox" name="chkBx" <?php echo ($yourCheckBoxStatus== "0") ? 'checked="checked"' : '' ; ?> value="0" /> | |
Re: You can't run php file like html file.You need test server(WAMP/XAMP) for testing php code. <?php function yourname($name) { echo "Your name is " .$name; } yourname("andi"); $age= 18; if ($age>=21) { echo ' alan'; } else{ echo ' bob'; } ?> | |
Re: Using hidden varable, u can pass values or post values Like <input type="hidden" name="id" value="<?php echo $yourId; ?>" /> |
The End.