background preloader

PHP

Facebook Twitter

Hypertext Preprocessor. How to Install PHP on Windows. This article was written in 2009 and remains one of our most popular posts. If you’re keen to learn more about PHP, you may find this recent article on PHP 5.4 of great interest. Hopefully, you now have a working local installation of Apache on your Windows PC. In this article we will install PHP 5 as an Apache 2.2 module. Why PHP? PHP remains the most widespread and popular server-side programming language on the web. Why Install PHP Locally? Installing PHP on your development PC allows you to safely create and test a web application without affecting the data or systems on your live website. All-in-One packages There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a single installation file, e.g. The PHP Installer Although an installer is available from php.net, I would recommend the manual installation if you already have a web server configured and running.

Manual Installation Manual installation offers several benefits: Web Platform - PHP on Windows. Accelerate with WinCache Windows Cache Extension for PHP is a PHP accelerator that increases the speed of PHP applications running on Windows and Windows Server. Add the Windows Cache Extension for PHP into your php.ini and get immediate performance benefits with zero code modifications. New features in WinCache 1.1 include Session Cache and User Cache with an APC compatible API providing advanced performance benefits for your PHP applications.

WinCache 1.1 Features: Support for PHP 5.2 and PHP 5.3 Configurable PHP opcode cache Configurable file cache to reduce file system I/O overhead Relative file path cache to avoid redundant mapping for absolute paths Session cache with file system persistence in web farm environments User cache for variables and application data with an APC API PHP file notification support to flush and rehydrate opcode cache PHP functions to obtain information about the cache status WinCache for PHP 5.2 (Web PI) Install WinCache for PHP 5.3 (Web PI) Easily Manage PHP on IIS 7. Multiple values for radio buttons in HTML form? PHP Tutorials: Radio Buttons. You can find the code for the page above in the files you downloaded , in the scripts folder. The file is called . Open it up in your text editor. If you want to copy and paste it, click below. The Radio Button Form Make sure you save your work as radioButton.php, as that's where we're posting the Form – to itself.

To get the value of a radio button with PHP code, again you access the NAME attribute of the HTML form elements. {*style:<b> $selected_radio = $_POST['gender']; print $selected_radio; ? This is more or less the same code as we used for the text box! $selected_radio = $_POST[' gender ']; } </b>*} Again, this is the same code you saw earlier – just access the form element called 'Submit1' and see if it is set. Try out the code. Radio buttons have another attribute - checked or unchecked. {*style:<b>$male_status = 'unchecked'; $female_status = 'unchecked'; </b>*} {*style:<b>if ($selected_radio = = 'male') { $male_status = 'checked'; else if ($selected_radio = = 'female') { >Male </b>*}

How to create a contact form in HTML | Help Center. This tutorial will teach you how to create a very simple contact form for HTML based website template. First of all create 2 files: contact_form.html and contact.php. The first file will contain HTML code for the form and the second -will process the data from the form Below is the HTML code of the contact form And this is how it will look in the browser Let’s have a quick look at some main aspects of it. Action=”contact.php” – this attribute specifies where to send the data from the contact form fields, when it has been submitted method=”post” – this attribute specifies how to send data from the form to the file specified in the action attribute The <input> and <textarea> tags should have an attribute “name” with a unique identifier.

That’s basically it. Now for the contact.php file that will actually grab the data from the fields, compose into a message and send to your email. $mail_to shall contain the site owner email, this is where the email is sent to. Free PHP scripts, code snippets and samples, useful PHP related links and more - Totally PHP. All Code Snippets - Totally PHP. PHP Best Codes. PHP. Scripting language created in 1994 PHP is a general-purpose scripting language geared towards web development.[8] It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995.[9][10] The PHP reference implementation is now produced by the PHP Group.[11] PHP was originally an abbreviation of Personal Home Page,[12][13] but it now stands for the recursive initialism PHP: Hypertext Preprocessor.[14] The standard PHP interpreter, powered by the Zend Engine, is free software released under the PHP License. PHP has been widely ported and can be deployed on most web servers on a variety of operating systems and platforms.[17] The PHP language has evolved without a written formal specification or standard, with the original implementation acting as the de facto standard that other implementations aimed to follow.

History[edit] Early history[edit] <! PHP/FI could be used to build simple, dynamic web applications. PHP 3 and 4[edit] PHP 5[edit] PHP 7[edit] PHP 8[edit] The no-framework PHP MVC framework - Rasmus' Toys Page. March 1, 2006 - Disclaimer: Since a lot of people seem to me misunderstanding this article. It isn't about OOP vs. Procedural programming styles. I happen to lean more towards procedural, but could easily have gone more OOP. I simplified the code a bit for brevity, but have added a light OO layer back in the model now.

So you want to build the next fancy Web 2.0 site? I don't have much of a problem with MVC itself. Goals for this approach Clean and simple designHTML should look like HTMLKeep the PHP code in the views extremely simple: function calls, simple loops and variable substitutions should be all you needSecureInput validation using pecl/filter as a data firewallWhen possible, avoid layers and other complexities to make code easier to audit FastAvoid include_once and require_onceUse APC and apc_store/apc_fetch for caching data that rarely changesStay with procedural style unless something is truly an objectAvoid locks at all costs Example Application The Code Input Filtering ui.inc. PHP/MySQL Tutorial - Learn how to execute PHP commands on the server. Step 3: There are at least two ways to query a database. One is to . Another way is . In this part of the tutorial we will show the first way.

The command will look like this: mysql_query($query); The command can be repeated over and over again in the source code. Here is the complete code that should be used to create a MySQL table in PHP: <? $user="username"; $password="password"; $database="database"; mysql_connect(localhost,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="CREATE TABLE tablename(id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,field1-name varchar(20) NOT NULL,field2-name varchar(20) NOT NULL,field3-name varchar(20) NOT NULL,field4-name varchar(30) NOT NULL,field5-name varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"; mysql_close(); Enter your database, MySQL username and MySQL password in the appropriate positions on the first three lines above. Step 4: Display table data. Command line usage. Spawning php-win.exe as a child process to handle scripting in Windows applications has a few quirks (all having to do with pipes between Windows apps and console apps).

To do this in C++: // We will run php.exe as a child process after creating // two pipes and attaching them to stdin and stdout // of the child process // Define sa struct such that child inherits our handles SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) }; sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; // Create the handles for our two pipes (two handles per pipe, one for each end) // We will have one pipe for stdin, and one for stdout, each with a READ and WRITE end HANDLE hStdoutRd, hStdoutWr, hStdinRd, hStdinWr; // Now create the pipes, and make them inheritable CreatePipe (&hStdoutRd, &hStdoutWr, &sa, 0)) SetHandleInformation(hStdoutRd, HANDLE_FLAG_INHERIT, 0); CreatePipe (&hStdinRd, &hStdinWr, &sa, 0) SetHandleInformation(hStdinWr, HANDLE_FLAG_INHERIT, 0); std::string processed(""); char buf[128];