Posts

Get PHP to display warnings and errors only not Notice

Just put the Below code in Php.ini error_reporting = E_ALL & ~E_NOTICE;

PHP - Getting notice Undefined index

      Question: I am getting the following message: Notice: Undefined index: action in /home/fhlinux170/c/cybernet-designs.co.uk/user/htdocs/formtest.php on line 17 . Line 17 contains this line of code if($_POST['action'] == "send") Anwser  This error appears because of your PHP error reporting settings. Usually, it appears when your variable is not properly set. There are two ways to handle this issue: 1. Check if $_POST['action'] is set before using it. For example: if (! isset ( $_POST [ 'action' ])) { //If not isset -> set with dumy value $_POST [ 'action' ] = "undefine" ; } 2. Suppress Notice warnings Notice warnings could be suppressed by changing the error_reporting variable in your PHP.ini. error_reporting  could be set to show all errors except those for notices and coding standards warnings:  error_reporting = E_ALL & ~E_NOTICE The same is accomplished by adding the following line in your ...

How do I turn off PHP Notices, Error and Warning?

Just write the below code <? php // Turn off all error reporting error_reporting ( 0 ); ?>

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") {             $curren...

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'); }