php – ProjectArchive.NET

Tag : php

How to check if a button is pressed.

How to check if a button is pressed using php .. 🙂 if (isset($_POST[‘button’])){ echo “button pressed”; } else { echo “button not pressed” ; } <form class=”form-horizontal” action=”check_button_pressed.php” method=”post”> <div class=”form-group”> <div class=”col-sm-offset-2 col-sm-10″><button class=”btn btn-default” name=”button” type=”submit”>Test</button></div> &nbsp; </div> &nbsp; </form>&nbsp; Will on button click display button pressed .. 🙂

Building an API

Imagine if you could take an existing sql database and turn it into a RESTful JSON based web service, then access the data via the API from perhaps an android application or an other third party application.  I wondered about this and then I stumbled upon PHP DATA SERVICES (PHPDS) built by Chatura Dilan  PHPDS

Use PHP to zip (archive) a folder

Here is a very simple way to use PHP to zip up (archive) a folder.

How to get and display wordpress comment details.

With wordpress sometimes we might like to output details to a seperate page or even outside of our wordpress folder. The following code is an example of how to grab the details for your comment details. I recently learned this to use it in my personal dashboard so that I could see new comments without

How to create a new database with PHP & PDO

Creating a new databse with PHP and PDO : <?php // Hosting details $host=”localhost”; $root=”root”; $root_password=”rootpass”; // New database user, password & database name $user=’newuser’; $pass=’newpass’; $db=”newdb”; // Create database connnection try { $dbh = new PDO(“mysql:host=$host”, $root, $root_password); // Exectute $dbh->exec(“CREATE DATABASE `$db`; CREATE USER ‘$user’@’localhost’ IDENTIFIED BY ‘$pass’; GRANT ALL ON `$db`.* TO