Posts

Showing posts from March, 2012

How to use google search in our webpage

--------------------------------Google search box---------------------------------------------- <form method="get" name="searchform" action="http://www.google.com/search" target="_blank"> <input type="hidden" name="sitesearch" value="" /> <input onfocus="searchfield_focus(this)" style="color:#808080;font-style:italic;" alt="search" type="text" name="as_q" size="55" value="" /> <input type="submit" value="Search" title="Search 4rapiddev.com" /> </form> ---------------------------------------------------------------------------------------------------

String breaking function

--------------------------------string breaking function------------------- $someWords = "Please don't blow me to pieces."; $wordChunks = explode(" ", $someWords); for($i = 0; $i < count($wordChunks); $i++){ echo "Piece $i = $wordChunks[$i] <br />"; } $wordChunksLimited = explode(" ", $someWords, 4); for($i = 0; $i < count($wordChunksLimited); $i++){ echo "Limited Piece $i = $wordChunksLimited[$i] <br />"; }

Mobile validation in Java scripts

----------------------Java Script for Contacts & mobile------------------------ <script language="javascript">         function Validate()         {             var x = document.form1.txtPhone.value;                        if(isNaN(x)||x.indexOf(" ")!=-1)            {               alert("Enter numeric value")               return false;            }            if (x.length>8)            {                 alert("enter 8 characters");                 return false;            }            if (x.charAt(0)!="2")            {                 alert("it should start with 2 ");                 return false            } var y = document.form1.txtMobile.value;            if(isNaN(y)||y.indexOf(" ")!=-1)            {               alert("Enter numeric value")               return false;            }            if (y.length>10)            {                 alert("e

Email Validations in Java Script

<SCRIPT LANGUAGE="JavaScript"> function verify()   {       function validEmail(emailV) { dotV = emailV.indexOf(".", emailV.length-4); if (emailV.length < 6) return false;     if (emailV.indexOf("@") < 1) return false;     if (emailV.indexOf("@") > (emailV.length-4)) return false; if (dotV == -1 || dotV > (emailV.length-3)) return false; for (var i=0; i < emailV.length; i++) { var tempV = emailV.substring(i, i+1) if (tempV == " " || tempV == "'" || tempV == '"' || tempV == "," || tempV == ";" || tempV == "`" || tempV == "<" || tempV == ">") { return false; } } }  if (document.form1.name.value == "")           {          alert("Please Fill Your Name");  document.form1.name.focus();      return (false);           }      else if (document.

How to use .htaccess file

--------------------------------.htaccess file coding------------------- RewriteEngine On RewriteRule ^index.html$ index.php RewriteRule ^about-us.html$ about-us.php RewriteRule ^contact-us.html$ contact-us.php RewriteRule ^careers.html$ careers.php RewriteRule ^products.html$ products.php RewriteRule ^(.*)-([0-9]+)\.html$ sub-products.php?name=$1&id=$2

How to send email in php

--------------------------------------mail function--------------------------------------- $message .="This is a notice that before of some days of expiry your domain generated on ".date("Y-m-d").".\r\n"; $message .= "Purchasing date :\t" . $row['dt_purchase'] ."\r\nExpiry Date :\t" . $row['dt_exp'] . "\r\nDescription :\t" . $row['description'] . ", \r\n"; $to = $row2['email']; $subject = "Domain Expire Alert"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=utf-8\r\n"; $headers .= "From: reply <admin@induswebi.com>\r\n"; $headers .= "Reply-To: admin\r\n"; $headers .= "X-mailer: php/" . phpversion(); mail($to, $subject, $message, $headers); ----------------------------------------end--------------------------------------------------------

Remove to space from string

<?php $str1 ="Atul Kumar Sharma"; echo $msg = str_replace(" ","", $str1 ); ?> ========Out put============= AtulKumarsharma

php code for uploading a file

<?php //----change acording to need-------------------- if ($_POST['submit']=="Update Products") { $query4 = "update sub_product set product_name ='".$_POST['desc']."' where id = '".$row['id']."' "; mysql_query($query4) or die(mysql_error()."Couldn't update record information!"); $query2 = "select * from main_product where product_id='".$row['Product_id']."'"; $result2 = mysql_query($query2)or die(mysql_error()."Couldn't retrive record information!"); echo $row2 = mysql_fetch_array($result2); if (file_exists("/images/sub_Product/". str_replace(" ","-",$row2['product_name'])."/" .$_FILES["image"]["name"]))       {       echo $_FILES["image"]["name"] . " already exists. ";       }     elseif($_FILES["image&qu