php session 1

Download Report

Transcript php session 1

Intro to Web
Programming
Presented by Blaine Hilton
Agenda
 Hand
out Packets
 Rules, Expectations, and other Required
Stuff
 Introductions – Why are you here?
 Introduction to LAMP
 Software Introduction
Rules and such
 Come
to class
 Be here on time
 Turn any noise maker off
 Pay for the class, if you haven’t already
 Don’t cheat
 Ask questions
Ask Questions
 We
only have 8 sessions
 Each session is 3 hours
 I’m going to make a very wide array of
information
 If you don’t understand something, its
going to get worst, not better
 If I’m not asked anything I’m going to
assume I should move through the
material faster
The book
 PHP
and MySQL Web Development
 ISBN: 0-672-32672-8
 946 pages
 Equals 135 pages to read per week
 Get it, its worth it, you will use it after the
class
LAMP Application Stack
 Linux
 Apache
 MySQL
 PHP
 WAMP
Comparison
Development Workflow
 Edit
files locally
 Publish to server
 Setup database
 Test
 Debug
File Transfer Methods
 FTP
 SFTP
 SCP
 Subversion
Introduction to the Lab
 Our
software is installed in the middle row
 Anything you save on the lab computer will
be erased at the end of class.
 All files must be saved to your flash drive,
it is highly recommended to backup your
flash drive to another drive and/or your
home computer often
Software Introduction
 PuTTY
 Subversion
 Tortoise
SVN
 Programmers Notepad
 WinSCP
 phpMyAdmin
Our Web Server
 www.web-design-class.com
 www.web-design-class.com/phpMyAdmin
 firstinitiallastname.web-design-class.com
Hello World
 <html>
 <head><title>Hello
World!</title></head>
 <body>
 <h1>Hello
 </body>
 </html>
World</h1>
Save and upload
 Make
a folder on your flash drive
 Save as “index.php”
 Subversion upload
 WinSCP Transfer
HTML Tags to Know


<table>
<tr>
 <td>
 <hr />
 <h1>-<h6>
 <p>
 <br />
 <pre>
 <form>
 <a href=“address”>Text</a>
 <img src=“image.jpg” alt=“description” width=“” height=“”>
Table Example


<table border=“1”>
<tr>




</tr>
<tr>






<td>1</td>
<td>Blaine</td>
</tr>
<tr>


<th>#</th>
<th>Name</th>
<td>2</td>
<td>Rick</td>
</tr>
</table>
Form Elements
 Text
Box
 Text Area
 Select
 Select Multiple
 Radio
 Checkbox
 Submit
 Hidden
Form Elements in HTML

<input type=“text” name=“name” value=“” />

<textarea name=“name" cols=40 rows=8>
</textarea name>







<select name=“name”
<option value=“value”>Display</option>
</select>
<select multiple name=“name" size=“4”>
<option value=“value”>Display</option>
</select>
Form Elements in HTML


<input type="radio" name=“color" value=“Red“ />
<input type="radio" name=“color" value=“Yellow” />
<input type=“checkbox" name=“color" value=“Red“ />
 <input type=“checkbox" name=“color" value=“Yellow” />


<input type=“submit” name=“name” value=“Click” />

<input type=“hidden” name=“name” value=“value” />
HTML Notes
 To
be well formed HTML needs to follow
some rules:


All tags are always lower case
All tags must be closed
Form Example
 Start
with Hello World
Database Introduction
 Key





Terms
Database
Table
Fields/Columns
Relationships
Keys
Field Types
 INT
 FLOAT
 VARCHAR
TEXT
 TINYINT
Database Keys
 Primary
Key
 Unique Key
 FullText
Database Communication - SQL
 INSERT
 SELECT
 UPDATE
PHP Introduction
 <?php
echo ‘Hello World’ ; ?>
 Note:



Opening
Closing
Semi Colon
Variables

<?php
 $university
= ‘Purdue’ ;
 echo “$university” ;
 ?>

Note:



Variable name starts with $
Colon ends each line
Multiple lines can be within one opening/closing block
Combining Strings


<?php
$fname
= ‘Blaine’ ;
$lname
= ‘Hilton’ ;
$university
= ‘Purdue’ ;
echo ‘My name is ‘.”$fname”.’ and I attend ‘.”$university”’.’ ;
?>

Note:








Again, anytime you open/start you must close/end
Single quotes are for non-changing information
Double quotes are for information that can change (variabiles, ect…)
You can usually always use double quotes, but it makes the page load longer
(more to think about)
First Application
 Goal:

Have students register their likes and dislikes.
 What



we need:
First Name
Last Name
Favorite Color
 What
else?