Posts

Showing posts with the label basic

How to set self page in form action?

In PHP some developer use same page for code and some use separate page for code of PHP script.so who use same page to script, they set page path in form tag as action.for that not set every time path of page use common code to put path of page. htmlspecialchars($_SERVER["PHP_SELF"]);  This code put in action attribute of form tag. this get current page path directly. For ex. <form name="test"  action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" >                    //Your code </from>

Let's make a webservice in php

It's easy to create web service in php. First create one php file in your website folder like " firstwebservice.php ". and open this file in any text editor. Now copy this code and past in file. <?php //add header for json header("Content-Type:application/json"); //if you send url paramers if(!empty($_REQUEST))     {         //url parameter "param"         if(isset($_REQUEST["param"]))         {             try             {                 $param=$_REQUEST['param'];                                  $response['status'] = 200;                 $...

PHP Syntax

 PHP Syntax Default file extension for php code is " .php ". .php file can have HTML tags, JavaScripts, PHP scripts.  A PHP script can be placed anywhere in the page. <?php code hear ?>  for print or display normaly userd "echo". Example <html>        <head>       </head>       <body>              <?php echo 'hello php!' ; ?>       </body>  </html>