ACM Web Development Workshop - PHP By Luis Torres.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
1 Chapter 5 – Handling HTML Controls in Web Pages spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Faculty of Sciences and Social Sciences HOPE PHP – Working with Input Stewart Blakeway FML 213
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Server-Side vs. Client-Side Scripting Languages
XFC Wallet User Instructions. Contents 1. Download Wallet 2. Set Wallet 3. Receive XFC 4. Send XFC 5. Transactions 6. Address Book 7. Notice.
HTML Form Processing Learning Web Design – Chapter 9, pp Squirrel Book – Chapter 11, pp
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
Python and Web Programming
 What I hate about you things people often do that hurt their Web site’s chances with search engines.
15. User Authentication, Form Validation, Paging. M. Udin Harun Al Rasyid, S.Kom, Ph.D
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Getting on the Web CCSD Technology Team. Post a page to the Web using a simple file transfer process Goal: Process: Create a Web page using Microsoft.
PHP HYPERTEXT: PREPROCESSOR By: Justin T. Pleva. WHAT IS PHP?  General purpose  Server-side web development  Console application.
ITM © Port, Kazman1 ITM 352 HTML Forms, Basic Form Processing.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
1 Introduction to PHP. 2 What is this “PHP” thing? Official description: “PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open Source.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
PHP : Hypertext Preprocessor
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.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
JavaScript & jQuery the missing manual Chapter 11
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
PHP By Jonathan Foss.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Getting Started with Canvas IDIA Spring 2013 Bridget M. Blodgett.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Website Development with PHP and MySQL Saving Data.
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 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
Setting up and getting going with…. MIT App Inventor.
Creating PHPs to Insert, Update, and Delete Data CS 320.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming –TextField Action Listeners, JEditorPane action listeners, HTML in a JEditorPane,
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
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.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
PHP Form Processing * referenced from
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Intro to PHP & Variables
Cookies BIS1523 – Lecture 23.
Part 2 Setting up a web server the easy way
Part 2 Setting up a web server the easy way
PHP and Forms.
Programming in JavaScript
Web Programming Language
Programming in JavaScript
Introduction to PHP.
Intro to Programming (in JavaScript)
Presentation transcript:

ACM Web Development Workshop - PHP By Luis Torres

DON’T FORGET TO INSTALL “WAMP or MAMP SERVER” ON YOUR COMPUTER google/yahoo/bing it

 Running wamp:

Click Start the services!

Localhost will open whatever is named index.html/index.php in the www directory

This folder will contain our website files, if you want to run a php file it has to be INSIDE of this folder

This is how the www folder will look like.(more or less)

Open “index.php”, erase all its content and replace with the following BE CAREFUL: This is the concatenation character in PHP. In java is the “+” character. Don’t confuse them!

Different approaches to code in php

Lets do functions! Our function doMath will take two inputs, and compute its sum. Since we are not declaring types, we ASSUME that the inputs will be integers. Inside the function we could check the types if we wanted to make sure that everything is ok.

OMG PHP is easy :D Well.. Lets continue to the other stuff

PHP $_GET  Purpose: Sometimes we want the same page to have a function that can do multiple outputs based on the input.  Ex: google search will work the same way, but will yield different outcomes.

PHP $_GET  How does it works?  In the google example, they use the URL, to pass variables that will be used in that page.

Wait… What?  Lets go back to the doMath function.  For the purpose of teaching, lets assume you have this URL: (you hard code the rest of the url)  Lets break it down: localhost/yourFile.php <- this is your file  ? Question mark shows where variables begin  variableA <- the variable “varaibleA” has a value of 2  & <- this character concatenates multiple variables  variableB <- the variable “varaibleB” has a value of 3

Notice how you get the values using get. GET will always get values from the URL

But without the URL it wont work :’(  Here is how to fix that, just check if the $_GET “isset()”: <?php if(isset($_GET['variableA'])) { $a=$_GET['variableA']; } else { echo "no input in URL, using variableA as 2 "; $a=2; } if(isset($_GET['variableB'])) { $b=$_GET['variableB']; } else { echo "no input in URL, using variableB as 3 "; $b=3; } echo doMath($a,$b); ?> <?php function doMath($a,$b) { return $a+$b; }

Now it works for both

But, how can I change the values being passed without hardcoding?   We have Forms variable A: variable B: <?php Rest of the code from previous example… ?>

How does it work? variable A: variable B: <?php Rest of the code from previous example… ?> Input type submit is a button, after clicking the button it will go to the specified file, with the specified values and execute. Will be obtained in yourFile.php using $_GET[‘variableName’]

What if I want to be mysterious and not show anything in the URL?  You can use the POST function  Similar to $_GET[‘variable’], you use $_POST[‘variable’] variable A: variable B: … <?php if(isset($_POST['variableA'])) { $a=$_POST['variableA']; } … …. You get the idea, it will work, and wont show the variables in the URL

Are they different? GET -variables shown at all times… horrible if you use get to pass a password -since it is shown in the URL, you can bookmark a specific location on your browser. Cool now you can send a specific query of a website to a friend. -URLs have a size limit! 2048 characters POST -variables hidden… you want to use this when submitting a password -cant be bookmarked, useful if you don’t want users to return to a specific part of a site…like submitting the payment. Since post variables don’t stay there, when the code tries to execute it will fail because of the missing variables. -don’t have a limit, and they are encrypted

PHP Include  What if you have a multiple functions, and you don’t want to copy paste them on all your files.  Really simple:

PHP Include  WONT WORK if you put the include after you method call.  Make sure all your includes are at the top of your code if possible.

Ermm we got this far..?  We are missing:  forms with PHP (dynamic forms)  Sessions  SQL/databases  Javascript  Ajax  So basically another workshop or 2..or more.