data

Reading data from text files with PHP

Reading data from text files with PHP

Before you read data stored in a file, use the fopen() function to open the file.
To read the data from the file, use fopen() in [e]read mode. After opening the
file, assign the contents of the file to a variable using the file() function. You can then print the contents of the file, then use the fclose() function to close the file after you are finished reading the data.

Function file(string filename [, int use_include_path])
The function reads all the contents of a file into an array. Each line of the file is a

      Subscribe in a reader

Using forms with PHP: part 3

Form Processing with PHP: Part 3

How to populate form fields with previously submitted values.

When you see the scripts in action, take a look at the source code, especially what the values of the form fields are set to before and after the scripts execute.

Input field:

To automatically have the value of an input field filled out, use the echo/print function to place the value submitted into the value attribute of the field.

PHP Code:

<?php
if ($submit && $firstname){
$fname = $firstname;
?>

What is your first name?

      Subscribe in a reader

Using forms with PHP: part 2

Form Processing with PHP Part 2

Radio buttons, checkboxes, select lists

Radio Buttons:

<input type="radio" name="radioset" value="data" CHECKED> data

VALUE: Sets the value of the form element.
RADIOSET links a group of radio buttons together, only one radio per set can be checked.
RADIOSET is alsothe name of the variable that will contain the value submitted by the form.
CHECKED is an optional attribute that makes a radio button active by default.
If the value is not set, "on" is the default value submitted. You can't tell which button in the set was chosen.

      Subscribe in a reader

Form Processing with PHP: Part 1

Form Processing with PHP: Part 1

Form Processing

Forms are usually used to gather information from visitors to your website. Once you've gathered the information, it can be used in several ways. It can be sent via email for someone to read, saved to database, or used to find data in the database that matches a specific criteria.

For example:

      Subscribe in a reader

Introduction to using MYSQL with PHP

Introduction

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a server-side scripting language that can be used on a host of webservers and platforms.

      Subscribe in a reader
Syndicate content