Topics Sending an email Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
XP Browser and Basics1. XP Browser and Basics2 Learn about Web browser software and Web pages The Web is a collection of files that reside.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
The Internet. Telnet Telnet means using your computer as a terminal. All commands you type are sent to the host computer you are connected to and executed.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Browser and Basics Tutorial 1. Learn about Web browser software and Web pages The Web is a collection of files that reside on computers, called.
1. 2 LXU800 User’s Manual 1.Installation – Windows XP UI Features Introduction Data Connection & Disconnection.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
PHP: Hypertext Processor Fred Durao
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Chapter 4 Handling User Input PHP Programming with MySQL 2nd Edition
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
(c) Manzur Ashraf, Short course, KFUPM PHP & MySQL 1 Basic PHP Class 2.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
INTERNET APPLICATION DEVELOPMENT For More visit:
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Let’s Make An Form! Bonney Armstrong GD 444 Westwood College February 9, 2005.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Includes and Dates.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
A little PHP. Enter the simple HTML code seen below.
What is and How Does it Work?  Electronic mail ( ) is the most popular use of the Internet. It is a fast and inexpensive way of sending messages.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Have a look how it is done. Use the page down to scroll through or Page up to go back.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
10 1 Hidden Fields and CGI/Perl Programming By Diane Zak.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
Chapter 11 Web Application Development Part 1. .php Script 11.1 on pages il.php
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
Configuration File – ProdigyView. Overview Objective Learn how to configure the system through the xml file. Requirements Understanding of the Defines.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Chapter 5 Validating Form Data with JavaScript
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Data Virtualization Tutorial… CORS and CIS
Intro to PHP & Variables
(Includes setup) FAQ ON DOCUMENTS (Includes setup)
Configuring Internet-related services
CNIT 131 HTML5 - Forms.
(Includes setup) FAQ ON DOCUMENTS (Includes setup)
How to install and manage exchange server 2010 OP Saklani.
Presentation transcript:

Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies

Sending an –Configuring PHP for ing –The Mail Function –Sending with Headers –Sending HTML mail

Configuring PHP for ing If u r using any *NIX environment- sendmail is automatically installed Any hosting Service – service provider will provide sendmail settings If we are not using sendmail- –We can use existing SMTP service –Install a mailserver such as Mailtraq

Parameters to set for configuration Once the mail server is installed we need to modify php.ini There are some important parameters to setup –SMTP: Set this to the ip address or DNS name of your SMTP server. (windows installation only) default value : localhost –smtp_port: Set this to the port PHP uses to connect to the SMTP server (windows installation only) default value 25 –Sendmail_from: The From address used by default by the PHP mail() command –Sendmail_path: the path to the sendmail program(*NIX servers only) most servers usr/sbin/sendmail

The Mail Function The mail() is used to Send mail using PHP Synatx bool mail ( string $to, string $subject, string $message, [ string $additional_headers,[ string $additional_parameters ]] )

parameters –to Receiver, or receivers of the mail. The formatting of this string must comply –subject Subject of the to be sent. – message Message to be sent. Each line should be separated with a LF (\n). Lines should not be larger than 70 characters  The remaining two are optional

Optional Parameters additional_headers (optional) String to be inserted at the end of the header. This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a LF (\n). additional_parameters (optional) The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting.

Multiple Recipients Sending message to multiple recipients- the addresses must be seperated with comma. Syntax:

Some Examples The wordwrap() function wraps a string into new lines when it reaches a specific length. This function returns the string broken into lines on success, or FALSE on failure. Example #1 Sending mail. Using mail() to send a simple <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters // we should use wordwrap() $message = wordwrap($message, 70); // Send 'My Subject', $message); ?>

Sending With Headers Example #2 Sending mail with extra headers. The addition of basic headers, telling the MUA the From and Reply-To addresses:

Collecting Data and Sending Mail we are going to create two Web pages, mailform.html and .php The file mailform.html will collect the data you are going to send. The file .php will actually send the message, using the data you enter. Save the first page as mailform.html. Note that mailform.html doesn’t actually have any PHP code in it. It simply collects the required data in an HTML form. Save the second page as .php. This second page will take the values entered into the first page, and send them in an .

Mail Form.html Enter DATA enter to address enter ur subject Enter ur Message

.php <?php ini_set("sendmail_from", ini_set("SMTP","mail.vit.ac.in"); echo " Welcome to ing with PHP "; echo " "; $to= $_REQUEST["to"]; $subject= $_REQUEST["subject"]; $message= $_REQUEST["MESSAGE"]; $from = $headers = "From:". $from; $send=mail($to,$subject,$message,$headers); if($send) echo "congrats! The following Mail has been Sent "; echo " To: $to "; echo " From: $from "; echo " Subject: $subject "; echo " Message: "; echo $message; else echo "error in sending mail...."; ?>

Running the script Load up the first page, mailform.html, in your browser, and enter some data. Make sure you use valid addresses so that you can verify their receipt. Click the Send button. A second page appears, similar to the one shown below. Open your client and check your e- mail

How it works Remember that if your .php page is not in the same folder as mailform.html, you have to provide the correct path: Once the user presses the Send button, .php is loaded. The first step in your PHP code assigns all the fields from mailform.html to variables. In order to specify from whom the is coming, use the optional fourth parameter for the mail() function, headers. $headers = “From: “. $from. “\r\n”; The mail() function returns a value of True if it is successful and False if it fails.

The mail() function returns a value of True if it is successful and False if it fails. You will use this function to make your application a little more user-friendly: $mailsent = mail($to, $subject, $message, $headers); if ($mailsent) { echo “Congrats! The following message has been sent: ”; echo “ To: $to ”; echo “ From: $from ”; echo “ Subject: $subject ”; echo “ Message: ”; echo $message; } else { echo “There was an error...”; } ?>