Posts

Showing posts from May, 2014

How manage session between three page in php.

PHP do you want user visit first page then and then go second. user can't go directly on secong page using web URL. e.g. login validation required for future process. below i written three php file and creating session between this file . f irst page index.php <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html>     <head>         <meta charset="UTF-8">         <title></title>     </head>     <body>         <?php         session_start();         if ($_SESSION['name'] != "$name") {             $currentvalue = $_SESSION['name'];             header("location:$currentvalue.php");         } else {             ?>             <form action="" method="post" name="ind">                 <i

Make an image responsive - simplest way

You can try doing <p> <a href = "MY WEBSITE LINK" target = "_blank" > <img src = "IMAGE LINK" style = ' width : 100% ; ' border = "0" alt = "Null" > </a> </p> This should scale your image if in a fluid layout. For responsive (meaning your layout reacts to the size of the window) you can add a class to the image and use @media queries in css to change the width of the image.

how to create template file in php. why it is usefull

ravimane and php,mysql     that code that is same in two page no need to write twice , just make one file having that code and call or include anywhere you want.     everyone have been trying with .tpl.php extension. but doesn't matter what you want take, but with .php extension. that cool na  .so check out below and seek whatever you want .     below i made three file         top.php <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/style.css" type="text/css"> <meta name="Author" content="YOUR NAME HERE"> middle.php </head> <body> <div id="banner"> <img src="xyzlogo.gif" alt="XYZ, Inc. logo"> </div> <div id="menu"> <a href="index.php">Home</a> | <a href="sitemap.php">Sitemap</a> | <a hr

stop inserting data in the database when refreshing the page.

The best way to prevent that is to add header('Location: filename') after your query. Thus in your case, if ( isset ( $_POST [ 'submit' ])) { $user = $_POST [ 'username' ]; $email = $_POST [ 'useremail' ]; $pass = $_POST [ 'password' ]; mysql_query ( "INSERT INTO table (username, useremail, email) VALUES ('$username','$useremail','$email'); //must be inside the condition to prevent too many redirects header('Location: user_details_page.php'); }